Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 7 additions & 2 deletions tools/clang/unittests/HLSLExec/LinAlgTests.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -505,7 +505,7 @@ static void runSplatStore(ID3D12Device *Device,
const size_t BufferSize = Params.totalBytes();

std::stringstream ExtraDefs;
ExtraDefs << "-DFILL_VALUE=" << FillValue;
ExtraDefs << std::showpoint << "-DFILL_VALUE=" << FillValue;
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

I ran into this with WARP too before seeing this text in the DXIL section of the spec:

Fills a matrix with a scalar value. The scalar's type does not need to match the matrix component's type, a type conversion is applied following the rules documented in the Conversions section.

So even if it is a 42 integer value, the driver should be converting it to a float in the fill instruction anyway.

Copy link
Copy Markdown
Contributor

@tex3d tex3d May 4, 2026

Choose a reason for hiding this comment

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

That sounds right, however shouldn't we also suffix the value with F to ensure that it is always interpreted as float in the shader? Otherwise, there might be a difference depending on conforming literals (pre-HLSL 202x).

Suggested change
ExtraDefs << std::showpoint << "-DFILL_VALUE=" << FillValue;
ExtraDefs << std::showpoint << "-DFILL_VALUE=" << FillValue << "F";


std::string Args = buildCompilerArgs(Params, ExtraDefs.str().c_str());

Expand Down Expand Up @@ -624,7 +624,7 @@ static const char ElementAccessShader[] = R"(
// flatten the 2D index into a 1D index then scale by element size
// Always store row-major and work it out in the test runner
uint coordToByteOffset(uint2 coord) {
return (coord.y * M_DIM + coord.x) * ELEM_SIZE;
return (coord.x * N_DIM + coord.y) * ELEM_SIZE;
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Good catch. It sure can be confusing for x to be row and y to be column, but makes most sense in context.

}

[WaveSize(4, 64)]
Expand Down Expand Up @@ -935,6 +935,7 @@ static void runMatMatMul(ID3D12Device *Device,
const size_t BufferSize = Params.totalBytes();

std::stringstream ExtraDefs;
ExtraDefs << std::showpoint;
ExtraDefs << " -DK_DIM=" << K;
ExtraDefs << " -DA_FILL=" << AFill;
ExtraDefs << " -DB_FILL=" << BFill;
Expand Down Expand Up @@ -1017,6 +1018,7 @@ static void runMatMatMulAccum(ID3D12Device *Device,
const size_t BufferSize = Params.totalBytes();

std::stringstream ExtraDefs;
ExtraDefs << std::showpoint;
ExtraDefs << " -DK_DIM=" << K;
ExtraDefs << " -DA_FILL=" << AFill;
ExtraDefs << " -DB_FILL=" << BFill;
Expand Down Expand Up @@ -1094,6 +1096,7 @@ static void runMatAccum(ID3D12Device *Device,
const size_t BufferSize = Params.totalBytes();

std::stringstream ExtraDefs;
ExtraDefs << std::showpoint;
ExtraDefs << " -DLHS_FILL=" << LHSFill;
ExtraDefs << " -DRHS_FILL=" << RHSFill;

Expand Down Expand Up @@ -1551,6 +1554,7 @@ static void runStoreMemory(ID3D12Device *Device,
const size_t BufferSize = Params.totalBytes();

std::stringstream ExtraDefs;
ExtraDefs << std::showpoint;
ExtraDefs << " -DOFFSET=" << 0;
ExtraDefs << " -DFILL_VALUE=" << FillValue;

Expand Down Expand Up @@ -1631,6 +1635,7 @@ static void runAccumulateMemory(ID3D12Device *Device,
const size_t BufferSize = Params.totalBytes();

std::stringstream ExtraDefs;
ExtraDefs << std::showpoint;
ExtraDefs << " -DOFFSET=" << 0;
ExtraDefs << " -DFILL_VALUE=" << FillValue;

Expand Down
Loading