Skip to content

[DevSAN] Change DeviceType to specialization constant #19798

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

Open
wants to merge 1 commit into
base: sycl
Choose a base branch
from

Conversation

zhaomaosu
Copy link
Contributor

This will allow backend compiler to eliminte unnecessary code to reduce kernel code size.

This will allow backend compiler to eliminte unnecessary code to reduce
kernel code size.
@zhaomaosu zhaomaosu marked this pull request as ready for review August 14, 2025 06:48
@zhaomaosu zhaomaosu requested review from a team as code owners August 14, 2025 06:48
@@ -21,6 +21,9 @@ namespace ur_sanitizer_layer {

enum class DeviceType : uint32_t { UNKNOWN = 0, CPU, GPU_PVC, GPU_DG2 };

// Try to use a larger ID number to avoid conflict with user ID.
constexpr int SpecConstantDeviceTyID = 99;
Copy link
Contributor

Choose a reason for hiding this comment

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

I'm not sure this value is high enough to avoid conflicts. Normally the frontend would give our specialization constants a value based on the other specialization constants in the same TU. Is there a way we could leverage this to get a guaranteed unique ID?

Of course, it begs the question how the unified runtime would know what it would be. Maybe we can make the frontend offset the start of its assigned specialization constants based when the sanitizer is enabled? That way this could use 0 and the other specialization constants would start from 1 and increment.

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