Arrays were be joined in the order the JIT engine generated the arrays iso the order of the parameters.
Description
- A wrong assumption was made that the JIT engine would generate the arrays in the same order as provided by the parameters.
This assumption is violated when one of the generated arrays is an intermediate result of a previous specified JIT generated array.
Example of error condition:
af::array A{af::constant(1.,10)};
af::array R{af::join(0,-A,A)}; --> generated af::join(0,A,-A) because A is an intermediate result of -A.
In this fix, the order of the parameters is imposed, independent from the order of JIT generation.
PS: This bug appears in OPENCL and CUDA.
- The same 'unique' identifier "funcName" was generated for JIT kernels, with outputs as only difference.
As result, a different kernel could be executed than intended, dependent on the order of the JIT kernel generation.
Additional information about the PR answering following questions:
- bug fix
- can be back ported
- extra test is added covering a large set of possible combinations of similar outputs (567 combinations)
Fixes: #3511
Changes to Users
None
Checklist
- Rebased on latest master
- Code compiles
- Tests pass
- Functions added to unified API
- Functions documented