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

Validate calls to printf #5667

Closed
wants to merge 1 commit into from
Closed

Conversation

LU-JOHN
Copy link

@LU-JOHN LU-JOHN commented May 10, 2024

Kernels with calls to __builtin_printf can produce calls to printf in SPIRV. Add support in spirv-val to validate parameters to vararg functions.

Signed-off-by: Lu, John <john.lu@intel.com>
@CLAassistant
Copy link

CLAassistant commented May 10, 2024

CLA assistant check
All committers have signed the CLA.

Copy link
Contributor

@alan-baker alan-baker left a comment

Choose a reason for hiding this comment

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

The only printfs I'm aware of are the extended instructions DebugPrintf from NonSemantic.DebugPrintf and printf from OpenCL.std.

This is checking OpFunctionCall for something named printf (which requires an OpName attached). SPIR-V has no way to declare a vararg function using OpFunction. This doesn't seem like the right way to map printf.

@LU-JOHN
Copy link
Author

LU-JOHN commented May 10, 2024

The only printfs I'm aware of are the extended instructions DebugPrintf from NonSemantic.DebugPrintf and printf from OpenCL.std.

This is checking OpFunctionCall for something named printf (which requires an OpName attached). SPIR-V has no way to declare a vararg function using OpFunction. This doesn't seem like the right way to map printf.

Thanks. I'll investigate mapping printf to the printf instruction from OpenCL.std.

@LU-JOHN LU-JOHN closed this May 19, 2024
@LU-JOHN
Copy link
Author

LU-JOHN commented May 19, 2024

This PR is not the right solution. Update llvm-spirvto use printf instruction from OpenCL.std.

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.

None yet

3 participants