-
Notifications
You must be signed in to change notification settings - Fork 93
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Part of #1867: String GroupBy optimizations are timing out nightly tests #1869
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -481,7 +481,7 @@ module SegmentedString { | |
return computeOnSegments(offsets.a, values.a, SegFunction.StringIsTitle, bool); | ||
} | ||
|
||
proc bytesToUintArr(max_bytes:int, st) throws { | ||
proc bytesToUintArr(const max_bytes:int, st) throws { | ||
// bytes contained in strings < 128 bits, so concatenating is better than the hash | ||
if max_bytes < 8 { | ||
// we only need one uint array | ||
|
@@ -492,7 +492,16 @@ module SegmentedString { | |
} | ||
else { | ||
// we need two uint arrays | ||
var (numeric1, numeric2) = twoReturnComputeOnSegments(offsets.a, values.a, SegFunction.StringBytesTo2UintArrs, uint); | ||
ref off = offsets.a; | ||
ref vals = values.a; | ||
// should we do strings.getLengths()-1 to not account for null byte | ||
const lens = getLengths(); | ||
var numeric1, numeric2: [offsets.aD] uint; | ||
forall (o, l, n1, n2) in zip(off, lens, numeric1, numeric2) { | ||
const half = (l/2):int; | ||
n1 = stringBytesToUintArr(vals, o..#half); | ||
n2 = stringBytesToUintArr(vals, (o+half)..#half); | ||
} | ||
const concat1Name = st.nextName(); | ||
const concat2Name = st.nextName(); | ||
st.addEntry(concat1Name, new shared SymEntry(numeric1)); | ||
|
@@ -1429,11 +1438,8 @@ module SegmentedString { | |
The SegFunction called by computeOnSegments for bytesToUintArr | ||
*/ | ||
inline proc stringBytesToUintArr(values, rng) throws { | ||
var concat: uint; | ||
for v in values[rng] { | ||
concat = concat<<8 + v:uint; | ||
} | ||
return concat; | ||
var localSlice = new lowLevelLocalizingSlice(values, rng); | ||
return | reduce [i in 0..#rng.size] (localSlice.ptr(i):uint)<<(8*(rng.size-1-i)); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I know this should be equivalent to a more explicit forall, something like var concat: uint;
forall i in 0..#rng.size with (| reduce concat) {
concat |= (localSlice.ptr(i):uint)<<(8*(rng.size-1-i));
}
return concat; @ronawho @bradcray, I was wondering if there's any performance benefit between the two? I feel like the one line version could save on memory because (i don't think) we would need shadow variables? In this particular the example the loop should be small, so probably not a big deal, but it be nice to know for future reference There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Also, I don't feel like the localizing slice should be necessary since we're calling using There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. @pierce314159 : Sorry for the delayed response, I was out most of last week. I think the difference between your new code in 1441-1442, and your more explicit forall in the comment above should be a wash. Specifically, Chapel typically rewrites I'm not terribly familiar with |
||
} | ||
|
||
/* Test array of strings for membership in another array (set) of strings. Returns | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't immediately see any issues with this code but it's def the most complicated/part i understand the least, so it seemed like the natural choice to revert considering the timeout issue