Skip to content
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

Design testing approach to compare instructions generated by dpex and sycl #1186

Open
ZzEeKkAa opened this issue Oct 20, 2023 · 2 comments
Open
Assignees

Comments

@ZzEeKkAa
Copy link
Contributor

ZzEeKkAa commented Oct 20, 2023

We need to make sure that numba_dpex generate same llvm instructions as sycl.

Proposal:

LLVM uses FileCheck because they are comparing strings generated for the different platform. We may not need this flexibility, since we want to compare generated llvm code. It is always the same since we don't have options that affect llvm generated code. We may use this feature if cuda specific llvm ir will differe.

FileCheck is just a command line tool that needs to be called. We may want to write python wrapper for it.

Possible check flow:

  1. create sycl kernel with filecheck llvm instructions in the code
  2. run tests on those cpp files (we want to catch if sycl behavior changes)
  3. create same dpex kernels (just kernels without instructions)
  4. generate llvm ir code for each dpex kernel
  5. run FileCheck on dpex llvm code comparing it to the corresponding filecheck of sycl kernel

4 and 5 can be performed as cli commands and put in the cpp code.

Implementation status:

@ZzEeKkAa ZzEeKkAa self-assigned this Oct 20, 2023
@ZzEeKkAa ZzEeKkAa changed the title Create design for testing instructions generated by dpex and sycl Design testing approach to compare instructions generated by dpex and sycl Oct 20, 2023
@chudur-budur
Copy link
Contributor

  1. Compare this line to the llvm output of cpp code. We can use Filecheck here, since we need to compile cpp code using cli anyway.

The llvm IR generated from a cpp code and that from a python code might not be always ad-verbatim for a complex program with lots of variables, branching and loops, especially if you are planning to do a line-by-line comparison. You can check it here:

https://godbolt.org/

@ZzEeKkAa
Copy link
Contributor Author

ZzEeKkAa commented Nov 2, 2023

Thank you @chudur-budur ! I've just updated proposal after talking to @diptorupd

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants