Skip to content

Conversation

@adarshyoga
Copy link
Contributor

@adarshyoga adarshyoga commented Feb 21, 2023

  • Have you provided a meaningful PR description?

Adding functionality to output LLVM IR to a file. The output file name contains a hash generated from the LLVM module name. This allows us to write different kernels to separate files since the hash is expected to be unique.

  • Have you added a test, reproducer or referred to an issue with a reproducer?

Tested with Blackscholes in dpbench. File name generated is llvm_kernel_ce84b7ebc25a6c5f71403d77de797be75067dce745a14ae28ca34dc5e3365998.ll

  • Have you tested your changes locally for CPU and GPU devices?
    Tested on GPU

  • Have you made sure that new changes do not introduce compiler warnings?

  • If this PR is a work in progress, are you filing the PR as a draft?

self._module_name = kernel.name

# Dump LLVM IR if DEBUG flag is set.
if config.DEBUG:
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can we use a new flag NUMBA_DPEX_DUMP_KERNEL_LLVM? The DEBUG seems to turn on debug symbols in some places.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Added. Could not find any place where documentation needs to be updated with the env var. If I have missed it, let me know.

@mingjie-intel
Copy link
Contributor

Tested the code with small code from #906 , llvm IR is printed.

@diptorupd
Copy link
Contributor

@adarshyoga Thank you! It is good to go, but we need a test case. Just to verify that setting the config actually generates the IR file in the right location and the file is not empty.

Refer: https://docs.pytest.org/en/6.2.x/tmpdir.html#the-tmpdir-fixture

@adarshyoga
Copy link
Contributor Author

@adarshyoga Thank you! It is good to go, but we need a test case. Just to verify that setting the config actually generates the IR file in the right location and the file is not empty.

Refer: https://docs.pytest.org/en/6.2.x/tmpdir.html#the-tmpdir-fixture

Added a test case that tests both positive and negative cases.

@diptorupd diptorupd merged commit f0adad1 into IntelPython:main Feb 24, 2023
github-actions bot added a commit that referenced this pull request Feb 24, 2023
Output LLVM IR if NUMBA_DPEX_DEBUG environment variable is set f0adad1
@adarshyoga adarshyoga deleted the dump_llvm_debug branch February 24, 2023 23:31
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

Successfully merging this pull request may close these issues.

3 participants