Skip to content

[Regression] Passing a capability as a string into Slang crashes/is-invalid #7869

@ArielG-NV

Description

@ArielG-NV

Regression from #6538:
If we pass a string as a capability to Slang, the following code will crash in debug & return false in release:

            bool specificCapabilityRequested =
                targetOptionSet.hasOption(CompilerOptionName::Capability) &&
                (targetOptionSet.getIntOption(CompilerOptionName::Capability) !=
                 SLANG_CAPABILITY_UNKNOWN);

Error message in debug: "error: Failed to load module: assert failure: result->getCount() != 0 && (*result)[0].kind == CompilerOptionValueKind::Int"

Repro:
This can be repro'd by running slang-test with the given shader:

//TEST(compute):COMPARE_COMPUTE(filecheck-buffer=CHECK):-vk -output-using-type -emit-spirv-directly -profile spirv_1_3 -capability spvAtomicFloat64MinMaxEXT

// Tests if slang being providing capabilities as a string works as intended

//TEST_INPUT:ubuffer(data=[0 0 0 0], stride=4):out,name=outputBuffer
RWStructuredBuffer<int> outputBuffer;

[require(SPV_EXT_shader_atomic_float_min_max)]
void foo() {}

[shader("compute")]
[numthreads(1,1,1)]
void computeMain()
{
    foo();
    outputBuffer[0] = 1;
}

//CHECK: 1

Expected:
We do not crash in debug mode and specificCapabilityRequested is true in release.

Metadata

Metadata

Assignees

Type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions