Skip to content

Conversation

@bob80905
Copy link
Contributor

@bob80905 bob80905 commented Dec 5, 2025

This PR adds a test for CheckAccessFullyMapped. It builds on the previous test that was added to test the partially mapped / reserved resources infrastructure.
The test can be extended and simultaneously used to test both the reserved resources infrastructure and CheckAccessFullyMapped, the former implicitly and the latter explicitly.

It also tests unsigned ints directly given to CheckAccessFullyMapped, validating results for non-status inputs.
Fixes #181

Clang is currently failing, but will pass once llvm/llvm-project#170949 goes in.

Comment on lines +58 to +67
// Test that if CheckAccessFullyMapped is called on
// something other than an operation status,
// the LSB will be cast to a bool

unsigned int Nums[4] = {1, 2, 2147483647, 0};
for (unsigned int I = 0; I < 4; I++){
unsigned int Num_I = Nums[I];
CAFM[idx] = CheckAccessFullyMapped(Num_I);
idx++;
}
Copy link
Collaborator

Choose a reason for hiding this comment

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

I don't actually think we should test this usage - this feels like undefined behaviour territory. You aren't really allowed to call CheckAccessFullyMapped with anything other than the status value returned from a Sample, Gather, or Load: https://learn.microsoft.com/en-us/windows/win32/direct3dhlsl/checkaccessfullymapped - whatever it returns is kind of nonsense by definition.

Copy link
Collaborator

@bogner bogner Dec 8, 2025

Choose a reason for hiding this comment

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

Note that there is a INSTR.CHECKACCESSFULLYMAPPED error code listed in https://github.com/microsoft/DirectXShaderCompiler/blob/main/docs/DXIL.rst, so I would have hoped that doing this would fail validation. I guess it doesn't though based on the test results?

@bob80905
Copy link
Contributor Author

bob80905 commented Dec 8, 2025

This PR went the wrong direction, we shouldn't be testing that LLVM's implementation matches DXC's implementation of CheckAccessFullyMapped for incorrect usages. It's undefined behavior / something we don't need to worry about. The current test as it exists correctly tests the CheckAccessFullyMapped function, and the addition to the existing test is the wrong direction.

@bob80905 bob80905 closed this Dec 8, 2025
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.

Add test exercising CheckAccessFullyMapped

2 participants