Cast and literal
This produces wrong result on evaluation:
|_inp0: vec[i64]|
map(
_inp0,
|a: i64|
a < 3L
) {'_inp0': array([0, 1, 2, 3, 4])} []
=> [True False False False False]
However with casting it works:
|_inp0: vec[i64]|
map(
_inp0,
|a: i64|
a < i64(3L)
) {'_inp0': array([0, 1, 2, 3, 4])} []
=> [True True True False False]
The first Weld code works on length < 4 though.
There was an issue showing there's no vectorization when using casts; well it seems that it's actually broken? Maybe some special case/problem with booleans?
When combined with a filter it does seem to work correctly (pre-optimizations):
|_inp0: vec[i64]|
let obj101 = (map(
_inp0,
|a: i64|
a < i64(3L)
));
result(
for(
zip(_inp0, obj101),
appender[i64],
|b: appender[i64], i: i64, e: {i64, bool}|
if (e.$1,
merge(b, e.$0),
b)
)
)
=> [0 1 2]
Hey Radu, is this using the new or old backend?
Shoumik
On Mon, Sep 3, 2018 at 5:52 AM Radu [email protected] wrote:
This produces wrong result on evaluation:
|_inp0: vec[i64]| map( _inp0, |a: i64| a < 3L ) {'_inp0': array([0, 1, 2, 3, 4])} []
=> [True False False False False]
However with casting it works:
|_inp0: vec[i64]| map( _inp0, |a: i64| a < i64(3L) ) {'_inp0': array([0, 1, 2, 3, 4])} []
=> [True True True False False]
The first Weld code works on length < 4 though.
There was an issue showing there's no vectorization when using casts; well it seems that it's actually broken? Maybe some special case/problem with booleans?
When combined with a filter it does seem to work correctly (pre-optimizations):
|_inp0: vec[i64]| let obj101 = (map( _inp0, |a: i64| a < i64(3L) ));
result( for( zip(_inp0, obj101), appender[i64], |b: appender[i64], i: i64, e: {i64, bool}| if (e.$1, merge(b, e.$0), b) ) )
=> [0 1 2]
— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/weld-project/weld/issues/389, or mute the thread https://github.com/notifications/unsubscribe-auth/ABTCY6cNuunZGm5YGttUoXIUm531ZBAwks5uXSYfgaJpZM4WXkT5 .
-- Shoumik
Just re-built both latest master and llvm-st and both have the same output with/out casting.