diff --git a/tools/clang/unittests/HLSLExec/LinAlgTests.cpp b/tools/clang/unittests/HLSLExec/LinAlgTests.cpp index 961cc4f8a1..7b8aeeeba7 100644 --- a/tools/clang/unittests/HLSLExec/LinAlgTests.cpp +++ b/tools/clang/unittests/HLSLExec/LinAlgTests.cpp @@ -28,6 +28,10 @@ #include #include #include + +#define STREAM_FLOAT(stream, name, value) \ + stream << std::showpoint << " -D" << name << "=" << value << "F" \ + << std::noshowpoint #include #include @@ -505,7 +509,7 @@ static void runSplatStore(ID3D12Device *Device, const size_t BufferSize = Params.totalBytes(); std::stringstream ExtraDefs; - ExtraDefs << "-DFILL_VALUE=" << FillValue; + STREAM_FLOAT(ExtraDefs, "FILL_VALUE", FillValue); std::string Args = buildCompilerArgs(Params, ExtraDefs.str().c_str()); @@ -624,7 +628,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; } [WaveSize(4, 64)] @@ -936,8 +940,8 @@ static void runMatMatMul(ID3D12Device *Device, std::stringstream ExtraDefs; ExtraDefs << " -DK_DIM=" << K; - ExtraDefs << " -DA_FILL=" << AFill; - ExtraDefs << " -DB_FILL=" << BFill; + STREAM_FLOAT(ExtraDefs, "A_FILL", AFill); + STREAM_FLOAT(ExtraDefs, "B_FILL", BFill); std::string Args = buildCompilerArgs(Params, ExtraDefs.str().c_str()); @@ -1018,9 +1022,9 @@ static void runMatMatMulAccum(ID3D12Device *Device, std::stringstream ExtraDefs; ExtraDefs << " -DK_DIM=" << K; - ExtraDefs << " -DA_FILL=" << AFill; - ExtraDefs << " -DB_FILL=" << BFill; - ExtraDefs << " -DC_FILL=" << CFill; + STREAM_FLOAT(ExtraDefs, "A_FILL", AFill); + STREAM_FLOAT(ExtraDefs, "B_FILL", BFill); + STREAM_FLOAT(ExtraDefs, "C_FILL", CFill); std::string Args = buildCompilerArgs(Params, ExtraDefs.str().c_str()); @@ -1094,8 +1098,8 @@ static void runMatAccum(ID3D12Device *Device, const size_t BufferSize = Params.totalBytes(); std::stringstream ExtraDefs; - ExtraDefs << " -DLHS_FILL=" << LHSFill; - ExtraDefs << " -DRHS_FILL=" << RHSFill; + STREAM_FLOAT(ExtraDefs, "LHS_FILL", LHSFill); + STREAM_FLOAT(ExtraDefs, "RHS_FILL", RHSFill); std::string Args = buildCompilerArgs(Params, ExtraDefs.str().c_str()); @@ -1552,7 +1556,7 @@ static void runStoreMemory(ID3D12Device *Device, std::stringstream ExtraDefs; ExtraDefs << " -DOFFSET=" << 0; - ExtraDefs << " -DFILL_VALUE=" << FillValue; + STREAM_FLOAT(ExtraDefs, "FILL_VALUE", FillValue); std::string Args = buildCompilerArgs(Params, ExtraDefs.str().c_str()); @@ -1632,7 +1636,7 @@ static void runAccumulateMemory(ID3D12Device *Device, std::stringstream ExtraDefs; ExtraDefs << " -DOFFSET=" << 0; - ExtraDefs << " -DFILL_VALUE=" << FillValue; + STREAM_FLOAT(ExtraDefs, "FILL_VALUE", FillValue); std::string Args = buildCompilerArgs(Params, ExtraDefs.str().c_str());