Skip to content

Add basic support for replaying from SPIR-V #421

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

Merged
merged 1 commit into from
May 27, 2025

Conversation

Pennycook
Copy link
Contributor

Description of Changes

Previously, replay checked for either an OpenCL C source file (kernel.cl) or a device binary (*.bin). This commit adds another check for a SPIR-V binary (kernel.spv).

The intent behind these changes is to make it simpler to capture on one device and replay on another device, without needing access to the original source. More sophisticated changes would be required to fully automate this and support all cases (e.g., multiple SPIR-V files) but this simple change seemed in keeping with the existing "kernel.cl" path and is enough for my use-case.

Testing Done

I only ran a very simple test:

  1. Used OpenCL Intercept Layer to capture a kernel running on an Intel GPU, producing a DeviceBinary0.bin file.
  2. Used readelf and dd to extract the .spv section from DeviceBinary0.bin into kernel.spv.
  3. Used the modified run.py script to replay the kernel on an Intel CPU via PoCL.

Previously, replay checked for either an OpenCL C source file (kernel.cl) or a
device binary (*.bin). This commit adds another check for a SPIR-V binary
(kernel.spv).
Copy link
Contributor

@bashbaug bashbaug left a comment

Choose a reason for hiding this comment

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

Works for me! I think we should be able to dump the .spv file directly, assuming that the program is created from IL, which is probably is in many cases where we are currently dumping the device binary instead. I'll work on this shortly.

@bashbaug bashbaug merged commit a99ce7c into intel:main May 27, 2025
8 checks passed
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.

2 participants