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

Fix DxDispatch if spacing consistency #562

Merged
merged 1 commit into from
Mar 18, 2024
Merged
Show file tree
Hide file tree
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
6 changes: 3 additions & 3 deletions DxDispatch/src/dxdispatch/CommandLineArgs.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -302,7 +302,7 @@ CommandLineArgs::CommandLineArgs(int argc, char** argv)
m_inputRelPath = result["input_path"].as<std::filesystem::path>();
}

if(result.count("output_path"))
if (result.count("output_path"))
{
m_outputRelPath = result["output_path"].as<std::filesystem::path>();
}
Expand Down Expand Up @@ -378,7 +378,7 @@ CommandLineArgs::CommandLineArgs(int argc, char** argv)
}
}

if(result.count("dml_feature_level"))
if (result.count("dml_feature_level"))
{
m_dmlFeatureLevel = GetDmlFeatureLevelFromString(result["dml_feature_level"].as<std::string>());
}
Expand Down Expand Up @@ -545,7 +545,7 @@ void CommandLineArgs::SetAdapter(IAdapter* adapter)
{
m_commandListType = D3D12_COMMAND_LIST_TYPE_DIRECT;
}
else if(adapter->IsAttributeSupported(DXCORE_ADAPTER_ATTRIBUTE_D3D12_CORE_COMPUTE))
else if (adapter->IsAttributeSupported(DXCORE_ADAPTER_ATTRIBUTE_D3D12_CORE_COMPUTE))
{
m_commandListType = D3D12_COMMAND_LIST_TYPE_COMPUTE;
}
Expand Down
6 changes: 3 additions & 3 deletions DxDispatch/src/dxdispatch/Device.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -105,13 +105,13 @@ Device::Device(
featureLevel,
IID_PPV_ARGS(&m_d3d)));

if(enableDred)
if (enableDred)
{
// Enables more debug info for TDRs, can be used with Debugger
// extension see following link for more info:
// https://learn.microsoft.com/en-us/windows/win32/direct3d12/use-dred
ComPtr<ID3D12DeviceRemovedExtendedDataSettings> pDredSettings;
if(SUCCEEDED(m_d3dModule->GetDebugInterface(IID_PPV_ARGS(&pDredSettings))))
if (SUCCEEDED(m_d3dModule->GetDebugInterface(IID_PPV_ARGS(&pDredSettings))))
{
pDredSettings->SetAutoBreadcrumbsEnablement(D3D12_DRED_ENABLEMENT_FORCED_ON);
pDredSettings->SetPageFaultEnablement(D3D12_DRED_ENABLEMENT_FORCED_ON);
Expand Down Expand Up @@ -455,7 +455,7 @@ std::vector<std::byte> Device::Download(Microsoft::WRL::ComPtr<ID3D12Resource> d
}

ExecuteCommandListAndWait();
if(defaultBuffer->GetDesc().Width > std::numeric_limits<size_t>::max())
if (defaultBuffer->GetDesc().Width > std::numeric_limits<size_t>::max())
{
throw std::invalid_argument(fmt::format("Buffer width '{}' is too large.", defaultBuffer->GetDesc().Width));
}
Expand Down
6 changes: 3 additions & 3 deletions DxDispatch/src/dxdispatch/DmlDispatchable.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -148,7 +148,7 @@ void DmlDispatchable::Initialize()
FillBindingData(m_desc.bindPoints.inputs, &m_initBindings, nullptr, inputBindingData, true);

DML_BUFFER_ARRAY_BINDING bufferArrayBindings = {};
if(inputBindingData.bufferBindings.size() > std::numeric_limits<uint32_t>::max())
if (inputBindingData.bufferBindings.size() > std::numeric_limits<uint32_t>::max())
{
throw std::invalid_argument(fmt::format("Initialization Input BindingCount '{}' is too large.", inputBindingData.bufferBindings.size()));
}
Expand Down Expand Up @@ -217,7 +217,7 @@ void DmlDispatchable::Bind(const Bindings& bindings, uint32_t iteration)

THROW_IF_FAILED(m_device->DML()->CreateBindingTable(&bindingTableDesc, IID_PPV_ARGS(m_bindingTable.ReleaseAndGetAddressOf())));

if(inputBindingData.bindingDescs.size() > std::numeric_limits<uint32_t>::max())
if (inputBindingData.bindingDescs.size() > std::numeric_limits<uint32_t>::max())
{
throw std::invalid_argument(fmt::format("BindInputs count '{}' is too large.", inputBindingData.bindingDescs.size()));
}
Expand All @@ -242,7 +242,7 @@ void DmlDispatchable::Bind(const Bindings& bindings, uint32_t iteration)
DML_BINDING_DESC bindingDesc = { DML_BINDING_TYPE_BUFFER, &bufferBinding };
m_bindingTable->BindPersistentResource(&bindingDesc);
}
if(outputBindingData.bindingDescs.size() > std::numeric_limits<uint32_t>::max())
if (outputBindingData.bindingDescs.size() > std::numeric_limits<uint32_t>::max())
{
throw std::invalid_argument(fmt::format("BindOutputs count '{}' is too large.", outputBindingData.bindingDescs.size()));
}
Expand Down
4 changes: 2 additions & 2 deletions DxDispatch/src/dxdispatch/DxModules.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -72,10 +72,10 @@ D3d12Module::D3d12Module(bool disableAgilitySDK, const char* moduleName) : Modul
if (m_module)
{
#if !defined(_GAMING_XBOX) && defined(WIN32)
if(!disableAgilitySDK)
if (!disableAgilitySDK)
{
InitSymbol(&m_d3d12SDKConfiguration, "D3D12GetInterface");
if(m_d3d12SDKConfiguration)
if (m_d3d12SDKConfiguration)
{
ComPtr<ID3D12SDKConfiguration1> pD3D12SDKConfiguration;
THROW_IF_FAILED(m_d3d12SDKConfiguration(CLSID_D3D12SDKConfiguration, IID_PPV_ARGS(&pD3D12SDKConfiguration)));
Expand Down
6 changes: 3 additions & 3 deletions DxDispatch/src/dxdispatch/Executor.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -441,7 +441,7 @@ std::ostream& operator<<(std::ostream& os, const BufferDataView<T>& view)
{
auto nBytes = std::max(view.desc.sizeInBytes, (uint64_t) view.desc.initialValues.size());
uint64_t elementCount = nBytes / Device::GetSizeInBytes(view.desc.initialValuesDataType);
if(elementCount > std::numeric_limits<uint32_t>::max())
if (elementCount > std::numeric_limits<uint32_t>::max())
{
throw std::invalid_argument("Buffer size is too large");
}
Expand Down Expand Up @@ -518,7 +518,7 @@ void Executor::operator()(const Model::PrintCommand& command)
resource = m_resources[command.resourceName].Get();
bufferDesc = bufferDescTemp;
}
if(resource)
if (resource)
{
outputValuesStorage = m_device->Download(resource);
outputValues = outputValuesStorage;
Expand Down Expand Up @@ -573,7 +573,7 @@ void Executor::operator()(const Model::WriteFileCommand& command)
dimensions = std::vector<uint32_t>(command.dimensions);
tensorType = bufferDesc.initialValuesDataType;
}
if(resource)
if (resource)
{
fileDataStorage = m_device->Download(resource);
fileData = fileDataStorage;
Expand Down
2 changes: 1 addition & 1 deletion DxDispatch/src/dxdispatch/HlslDispatchable.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -369,7 +369,7 @@ void HlslDispatchable::Bind(const Bindings& bindings, uint32_t iteration)
auto FillViewDesc = [&](auto& viewDesc)
{
viewDesc.Buffer.StructureByteStride = bindPoint.structureByteStride;
if(source.elementCount > std::numeric_limits<uint32_t>::max())
if (source.elementCount > std::numeric_limits<uint32_t>::max())
{
throw std::invalid_argument(fmt::format("ElementCount '{}' is too large.", source.elementCount));
}
Expand Down
2 changes: 1 addition & 1 deletion DxDispatch/src/dxdispatch/OnnxDispatchable.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -415,7 +415,7 @@ void OnnxDispatchable::Bind(const Bindings& jsonBindings, uint32_t iteration)
tensorShapeUint32.push_back(1);
}

if(tensorShapeUint32.size() > std::numeric_limits<uint32_t>::max())
if (tensorShapeUint32.size() > std::numeric_limits<uint32_t>::max())
{
throw std::invalid_argument(fmt::format("TensorShapeUint32 '{}' is too large.", tensorShapeUint32.size()));
}
Expand Down
2 changes: 1 addition & 1 deletion DxDispatch/src/dxdispatch/dxDispatchWrapper.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ HRESULT DxDispatch::CreateDxDispatchFromJsonString(
ComPtr<DxDispatch> dxDispatchImpl;
ComPtr<IAdapter> adapter;

if(adapterUnk)
if (adapterUnk)
{
RETURN_IF_FAILED(adapterUnk->QueryInterface(IID_PPV_ARGS(&adapter)));
}
Expand Down
4 changes: 2 additions & 2 deletions DxDispatch/src/exe/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -23,14 +23,14 @@ int main(int argc, char** argv)
nullptr, // will log to console if not overwritten
&dispatch
);
if(hr == S_OK)
if (hr == S_OK)
{
RETURN_IF_FAILED(dispatch->RunAll());
}
else
{
// ignores S_FALSE
if(FAILED(hr))
if (FAILED(hr))
{
printf("%s failed with hr=0x%08x\n",argv[0], hr);
}
Expand Down