Skip to content

Commit 608840a

Browse files
Style fixes for CoopVec.h
1 parent be3992b commit 608840a

1 file changed

Lines changed: 42 additions & 43 deletions

File tree

tools/clang/unittests/HLSLExec/CoopVec.h

Lines changed: 42 additions & 43 deletions
Original file line numberDiff line numberDiff line change
@@ -12,20 +12,20 @@
1212

1313
struct LinAlgHeaderIncludeHandler : public IDxcIncludeHandler {
1414
private:
15-
DXC_MICROCOM_REF_FIELD(m_dwRef)
15+
DXC_MICROCOM_REF_FIELD(RefCount)
1616
dxc::DxcDllSupport &DxcSupport;
1717

1818
public:
1919
LinAlgHeaderIncludeHandler() = delete;
2020
LinAlgHeaderIncludeHandler(dxc::DxcDllSupport &DxcSupport)
21-
: m_dwRef(0), DxcSupport(DxcSupport) {}
21+
: RefCount(0), DxcSupport(DxcSupport) {}
2222

23-
DXC_MICROCOM_ADDREF_RELEASE_IMPL(m_dwRef)
23+
DXC_MICROCOM_ADDREF_RELEASE_IMPL(RefCount)
2424

25-
HRESULT STDMETHODCALLTYPE LoadSource(LPCWSTR pFilename,
26-
IDxcBlob **ppIncludeSource) {
27-
if (wcscmp(pFilename, L"dx/linalg.h") == 0 ||
28-
wcscmp(pFilename, L".\\dx\\linalg.h") == 0) {
25+
HRESULT STDMETHODCALLTYPE LoadSource(LPCWSTR Filename,
26+
IDxcBlob **IncludeSource) {
27+
if (wcscmp(Filename, L"dx/linalg.h") == 0 ||
28+
wcscmp(Filename, L".\\dx\\linalg.h") == 0) {
2929
WEX::Common::String ParamValue;
3030
if (FAILED(WEX::TestExecution::RuntimeParameters::TryGetValue(
3131
L"LinAlgHeader", ParamValue))) {
@@ -37,26 +37,25 @@ struct LinAlgHeaderIncludeHandler : public IDxcIncludeHandler {
3737
LPCWSTR RealHeaderPath =
3838
reinterpret_cast<LPCWSTR>(ParamValue.GetBuffer());
3939

40-
CComPtr<IDxcUtils> pHeaderUtils;
40+
CComPtr<IDxcUtils> HeaderUtils;
4141

42-
IFT(DxcSupport.CreateInstance(CLSID_DxcUtils, &pHeaderUtils));
42+
IFT(DxcSupport.CreateInstance(CLSID_DxcUtils, &HeaderUtils));
4343

44-
IDxcBlobEncoding *pHeaderBlob;
45-
IFT(pHeaderUtils->LoadFile(RealHeaderPath, nullptr, &pHeaderBlob));
44+
IDxcBlobEncoding *HeaderBlob;
45+
IFT(HeaderUtils->LoadFile(RealHeaderPath, nullptr, &HeaderBlob));
4646

47-
*ppIncludeSource = pHeaderBlob;
47+
*IncludeSource = HeaderBlob;
4848

4949
return S_OK;
5050
}
5151
return E_FAIL;
5252
}
5353

54-
HRESULT STDMETHODCALLTYPE QueryInterface(REFIID iid,
55-
void **ppvObject) override {
54+
HRESULT STDMETHODCALLTYPE QueryInterface(REFIID IID, void **Object) override {
5655
// FIXME: This is a workaround for a warning-as-error about unused parameters.
5756
#pragma warning(push)
5857
#pragma warning(disable : 4100)
59-
return DoBasicQueryInterface<IDxcIncludeHandler>(this, iid, ppvObject);
58+
return DoBasicQueryInterface<IDxcIncludeHandler>(this, IID, Object);
6059
#pragma warning(pop)
6160
}
6261
};
@@ -65,80 +64,80 @@ namespace CoopVecHelpers {
6564
template <typename EltTy>
6665
static std::vector<uint8_t> CreateAllOnesInputMatrix(uint32_t Width,
6766
uint32_t Height) {
68-
std::vector<EltTy> inputMatrix(Width * Height);
67+
std::vector<EltTy> InputMatrix(Width * Height);
6968
for (uint32_t i = 0; i < Width * Height; i++) {
7069
if constexpr (std::is_same_v<EltTy, uint8_t> ||
7170
std::is_same_v<EltTy, int8_t>) {
72-
inputMatrix[i] = 1;
71+
InputMatrix[i] = 1;
7372
} else if constexpr (std::is_same_v<EltTy, DirectX::PackedVector::HALF>) {
74-
inputMatrix[i] = ConvertFloat32ToFloat16(1.0f);
73+
InputMatrix[i] = ConvertFloat32ToFloat16(1.0f);
7574
} else if constexpr (std::is_same_v<EltTy, float>) {
76-
inputMatrix[i] = 1.0f;
75+
InputMatrix[i] = 1.0f;
7776
} else {
7877
WEX::Logging::Log::Error(L"Unsupported input type");
7978
break;
8079
}
8180
}
8281

8382
// Convert to uint8_t vector
84-
std::vector<uint8_t> uint8InputMatrix(inputMatrix.size() * sizeof(EltTy));
85-
std::memcpy(uint8InputMatrix.data(), inputMatrix.data(),
86-
inputMatrix.size() * sizeof(EltTy));
87-
return uint8InputMatrix;
83+
std::vector<uint8_t> Uint8InputMatrix(InputMatrix.size() * sizeof(EltTy));
84+
std::memcpy(Uint8InputMatrix.data(), InputMatrix.data(),
85+
InputMatrix.size() * sizeof(EltTy));
86+
return Uint8InputMatrix;
8887
}
8988

9089
template <typename EltTy>
9190
static std::vector<uint8_t> CreateInputVector(uint32_t NumThreads,
9291
uint32_t EltsPerThread) {
93-
std::vector<EltTy> inputVector(NumThreads * EltsPerThread);
94-
std::fill(inputVector.begin(), inputVector.end(), EltTy(0));
92+
std::vector<EltTy> InputVector(NumThreads * EltsPerThread);
93+
std::fill(InputVector.begin(), InputVector.end(), EltTy(0));
9594
if (EltsPerThread < 2) {
9695
WEX::Logging::Log::Error(L"EltsPerThread must be at least 2");
9796
return std::vector<uint8_t>();
9897
}
9998
for (uint32_t TID = 0; TID < NumThreads; TID++) {
10099
if constexpr (std::is_same_v<EltTy, uint8_t> ||
101100
std::is_same_v<EltTy, int8_t>) {
102-
inputVector[TID * EltsPerThread + 0] = 1;
103-
inputVector[TID * EltsPerThread + 1] = 1;
101+
InputVector[TID * EltsPerThread + 0] = 1;
102+
InputVector[TID * EltsPerThread + 1] = 1;
104103
} else if constexpr (std::is_same_v<EltTy, DirectX::PackedVector::HALF>) {
105-
inputVector[TID * EltsPerThread + 0] = ConvertFloat32ToFloat16(1.0f);
106-
inputVector[TID * EltsPerThread + 1] = ConvertFloat32ToFloat16(1.0f);
104+
InputVector[TID * EltsPerThread + 0] = ConvertFloat32ToFloat16(1.0f);
105+
InputVector[TID * EltsPerThread + 1] = ConvertFloat32ToFloat16(1.0f);
107106
} else if constexpr (std::is_same_v<EltTy, float>) {
108-
inputVector[TID * EltsPerThread + 0] = 1.0f;
109-
inputVector[TID * EltsPerThread + 1] = 1.0f;
107+
InputVector[TID * EltsPerThread + 0] = 1.0f;
108+
InputVector[TID * EltsPerThread + 1] = 1.0f;
110109
} else {
111110
WEX::Logging::Log::Error(L"Unsupported input type");
112111
break;
113112
}
114113
}
115114

116115
// Convert to uint8_t vector
117-
std::vector<uint8_t> uint8InputVector(inputVector.size() * sizeof(EltTy));
118-
std::memcpy(uint8InputVector.data(), inputVector.data(),
119-
inputVector.size() * sizeof(EltTy));
120-
return uint8InputVector;
116+
std::vector<uint8_t> Uint8InputVector(InputVector.size() * sizeof(EltTy));
117+
std::memcpy(Uint8InputVector.data(), InputVector.data(),
118+
InputVector.size() * sizeof(EltTy));
119+
return Uint8InputVector;
121120
}
122121

123122
template <typename EltTy>
124123
static std::vector<uint8_t> CreateInputBias(uint32_t NumElts) {
125-
std::vector<EltTy> inputBias(NumElts);
124+
std::vector<EltTy> InputBias(NumElts);
126125
if constexpr (std::is_same_v<EltTy, uint8_t> ||
127126
std::is_same_v<EltTy, int8_t>) {
128-
std::fill(inputBias.begin(), inputBias.end(), EltTy(1));
127+
std::fill(InputBias.begin(), InputBias.end(), EltTy(1));
129128
} else if constexpr (std::is_same_v<EltTy, DirectX::PackedVector::HALF>) {
130-
std::fill(inputBias.begin(), inputBias.end(),
129+
std::fill(InputBias.begin(), InputBias.end(),
131130
ConvertFloat32ToFloat16(1.0f));
132131
} else if constexpr (std::is_same_v<EltTy, int32_t>) {
133-
std::fill(inputBias.begin(), inputBias.end(), 1);
132+
std::fill(InputBias.begin(), InputBias.end(), 1);
134133
} else {
135134
WEX::Logging::Log::Error(L"Unsupported bias type");
136135
}
137136
// Convert to uint8_t vector
138-
std::vector<uint8_t> uint8InputBias(inputBias.size() * sizeof(EltTy));
139-
std::memcpy(uint8InputBias.data(), inputBias.data(),
140-
inputBias.size() * sizeof(EltTy));
141-
return uint8InputBias;
137+
std::vector<uint8_t> Uint8InputBias(InputBias.size() * sizeof(EltTy));
138+
std::memcpy(Uint8InputBias.data(), InputBias.data(),
139+
InputBias.size() * sizeof(EltTy));
140+
return Uint8InputBias;
142141
}
143142

144143
static std::wstring

0 commit comments

Comments
 (0)