Skip to content

[DevMSAN] Unpoison sret argument for builtin function to get spec constant #19800

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 3 commits into
base: sycl
Choose a base branch
from

Conversation

zhaomaosu
Copy link
Contributor

For builtin func like "__sycl_getComposite2020SpecConstantValue", if structs which are larger than 64b will be returned via sret arguments and will be initialized inside the function. So we need to unpoison the sret arguments.

…stant

For builtin func like "__sycl_getComposite2020SpecConstantValue", if structs
which are larger than 64b will be returned via sret arguments and will be
initialized inside the function. So we need to unpoison the sret arguments.
@zhaomaosu zhaomaosu marked this pull request as ready for review August 14, 2025 08:15
@zhaomaosu zhaomaosu requested a review from a team as a code owner August 14, 2025 08:15
Copy link
Contributor

@Copilot Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull Request Overview

This pull request implements support for unpoisoning sret (struct return) arguments for SYCL builtin functions that return large structs (>64 bits) in MemorySanitizer. The main change addresses the fact that these builtin functions initialize struct return values internally, requiring the memory sanitizer to mark these return values as clean.

  • Adds special handling for __sycl_getComposite2020SpecConstantValue builtin function in MemorySanitizer
  • Implements a new runtime function __msan_unpoison_shadow for unpoisoning arbitrary memory regions
  • Updates test configurations to set ZE_AFFINITY_MASK=0 for sanitizer tests

Reviewed Changes

Copilot reviewed 6 out of 6 changed files in this pull request and generated no comments.

Show a summary per file
File Description
llvm/lib/Transforms/Instrumentation/MemorySanitizer.cpp Adds detection and handling of SYCL builtin functions with sret parameters, unpoisoning their return values
libdevice/sanitizer/msan_rtl.cpp Implements new __msan_unpoison_shadow runtime function and refactors debug message constants
llvm/test/Instrumentation/MemorySanitizer/SPIRV/spec_constants.ll Adds test case verifying correct unpoisoning of sret arguments for spec constant builtin functions
sycl/test-e2e/ThreadSanitizer/lit.local.cfg Sets ZE_AFFINITY_MASK environment variable for test isolation
sycl/test-e2e/MemorySanitizer/lit.local.cfg Sets ZE_AFFINITY_MASK environment variable for test isolation
sycl/test-e2e/AddressSanitizer/lit.local.cfg Sets ZE_AFFINITY_MASK environment variable for test isolation

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.

1 participant