Closed dcrc2 closed 2 years ago
Replace structured bindings with explicit calls to ks::get. This should be exactly equivalent, and avoids compile errors when using nvcc (which incorrectly rejects lambdas which capture a structured binding).
ks::get
Before:
ty$fwd$add$aff fwd$add$aff(ks::allocator * $alloc, ks::Tuple<ks::Float,ks::Float> xt, ks::Tuple<ks::Float,ks::Float> dxt) { auto [dx1, dx2] = dxt; ks::Float c$0 = add$aff($alloc, dx1, dx2); return (c$0); }
After:
ty$fwd$add$aff fwd$add$aff(ks::allocator * $alloc, ks::Tuple<ks::Float,ks::Float> xt, ks::Tuple<ks::Float,ks::Float> dxt) { ks::Tuple<ks::Float,ks::Float> c$1 = dxt; auto dx1 = ks::get<0>(c$1); auto dx2 = ks::get<1>(c$1); ks::Float c$0 = add$aff($alloc, dx1, dx2); return (c$0); }
I don't feel I've written this very cleanly - any suggestions @toelli-msft ?
Seems clear enough relative to the standards of Cgen.
Cgen
Replace structured bindings with explicit calls to
ks::get
. This should be exactly equivalent, and avoids compile errors when using nvcc (which incorrectly rejects lambdas which capture a structured binding).Before:
After: