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

Validator: Support SPV_NV_raw_access_chains #5568

Merged
merged 1 commit into from
Apr 10, 2024

Conversation

rlocatti-nv
Copy link
Contributor

@CLAassistant
Copy link

CLAassistant commented Feb 12, 2024

CLA assistant check
All committers have signed the CLA.

@rlocatti-nv rlocatti-nv marked this pull request as ready for review February 14, 2024 20:23
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.

Please also update the DEPS file to point to the latest SPIRV-Headers.

const Instruction* inst) {
std::string instr_name = "Op" + std::string(spvOpcodeString(inst->opcode()));

if (!_.features().raw_access_chains) {
Copy link
Contributor

Choose a reason for hiding this comment

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

This requirement is already communicated via the grammar.


// The pointed storage class must be valid.
const auto storage_class = result_type->GetOperandAs<spv::StorageClass>(1);
if (storage_class != spv::StorageClass::Workgroup &&
Copy link
Contributor

Choose a reason for hiding this comment

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

Workgroup is not listed as a valid storage class in the spec. Is that a spec bug or tooling bug?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

It was a bug here. Removed it.

}

const auto stride = _.FindDef(inst->GetOperandAs<uint32_t>(3));
if (stride->opcode() != spv::Op::OpConstant) {
Copy link
Contributor

Choose a reason for hiding this comment

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

There is no type checking of stride, index, or offset. Is that intentional?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Added type checking. It was not intentional.

@@ -71,6 +71,9 @@ class ValidationState_t {
// and its values to be used without
// requiring any capability

// Allow using raw access chains through the RawAccessChainsEXT capability
bool raw_access_chains = false;
Copy link
Contributor

Choose a reason for hiding this comment

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

I think this is unnecessary. If feature is checked for it should be done via HasCapability(spv::Capability::RawAccessChainsNV).

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.

It would also be useful to have unit tests for the new functionality.

rlocatti-nv added a commit to rlocatti-nv/SPIRV-Tools that referenced this pull request Mar 4, 2024
This is needed to unblock builds with updated SPIR-V headers.
It is not a replacement for KhronosGroup#5568.
rlocatti-nv added a commit to rlocatti-nv/SPIRV-Tools that referenced this pull request Mar 5, 2024
This is needed to unblock builds with updated SPIR-V headers.
It is not a replacement for KhronosGroup#5568.
rlocatti-nv added a commit to rlocatti-nv/SPIRV-Tools that referenced this pull request Mar 6, 2024
This is needed to unblock builds with updated SPIR-V headers.
It is not a replacement for KhronosGroup#5568.
alan-baker pushed a commit that referenced this pull request Mar 6, 2024
This is needed to unblock builds with updated SPIR-V headers.
It is not a replacement for #5568.
@rlocatti-nv rlocatti-nv force-pushed the SPV_NV_raw_access_chains branch from 666c3c4 to a5daa1d Compare March 6, 2024 21:18
@rlocatti-nv
Copy link
Contributor Author

Added unit tests for most of the checks.

@alan-baker
Copy link
Contributor

You'll need to update DEPS to include the SPIRV-Headers that includes raw access chains for the bots to work correctly.

@alan-baker
Copy link
Contributor

Now the bots are complaining about a redefinition of the operand enums. Please rebase on main.

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.

Also formatting needs updated.

OpFunctionEnd
)";
CompileSuccessfully(str.c_str());
EXPECT_EQ(SPV_ERROR_INVALID_CAPABILITY, ValidateInstructions());
Copy link
Contributor

Choose a reason for hiding this comment

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

When testing error cases, the style is generally to have an additional expectation along the lines of:

EXPECT_THAT(getDiagnosticString(),
                          HasSubstr("error string or relevant substring to confirm right error is triggered"));

@rlocatti-nv rlocatti-nv force-pushed the SPV_NV_raw_access_chains branch from 71bfaf4 to 352963b Compare March 11, 2024 17:23
@rlocatti-nv rlocatti-nv force-pushed the SPV_NV_raw_access_chains branch from 352963b to 81d6676 Compare March 19, 2024 20:22
@HansKristian-Work
Copy link
Contributor

Is there any ETA on when we get some forward progress on this PR? I'm waiting for this PR to get merged.

@alan-baker
Copy link
Contributor

I think this likely needs a rebase to address some of the bot failures.

@rlocatti-nv rlocatti-nv force-pushed the SPV_NV_raw_access_chains branch from 81d6676 to a39e7bc Compare April 9, 2024 22:24
@alan-baker alan-baker merged commit 6761288 into KhronosGroup:main Apr 10, 2024
24 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.

5 participants