Skip to content
Open
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
2 changes: 2 additions & 0 deletions include/API/Device.h
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,8 @@ class Device {
virtual GPUAPI getAPI() const = 0;
virtual llvm::Error executeProgram(Pipeline &P) = 0;
virtual void printExtra(llvm::raw_ostream &OS) {}
virtual uint32_t getSubgroupSize() const = 0;
virtual std::pair<uint32_t, uint32_t> getMinMaxSubgroupSize() const = 0;

virtual ~Device() = 0;

Expand Down
22 changes: 22 additions & 0 deletions lib/API/DX/Device.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -337,6 +337,28 @@ class DXDevice : public offloadtest::Device {
return Caps;
}

uint32_t getSubgroupSize() const override {
D3D12_FEATURE_DATA_D3D12_OPTIONS1 Options1 = {};
if (FAILED(Device->CheckFeatureSupport(D3D12_FEATURE_D3D12_OPTIONS1,
&Options1, sizeof(Options1))))
return 0;
return Options1.WaveLaneCountMin;
}
std::pair<uint32_t, uint32_t> getMinMaxSubgroupSize() const override {
D3D12_FEATURE_DATA_D3D12_OPTIONS1 Options1 = {};
if (FAILED(Device->CheckFeatureSupport(D3D12_FEATURE_D3D12_OPTIONS1,
&Options1, sizeof(Options1))))
return {0, 0};
return {Options1.WaveLaneCountMin, Options1.WaveLaneCountMax};
}

void printExtra(llvm::raw_ostream &OS) override {
OS << " SubgroupSize: " << getSubgroupSize() << "\n";
auto MinMax = getMinMaxSubgroupSize();
OS << " MinSubgroupSize: " << MinMax.first << "\n";
OS << " MaxSubgroupSize: " << MinMax.second << "\n";
}

void queryCapabilities() {
CD3DX12FeatureSupport Features;
Features.Init(Device.Get());
Expand Down
41 changes: 41 additions & 0 deletions lib/API/MTL/MTLDevice.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -484,6 +484,47 @@ class MTLDevice : public offloadtest::Device {
MTLDevice(MTL::Device *D) : Device(D) {
Description = Device->name()->utf8String();
}
uint32_t getSubgroupSize() const override {
const char *Src = R"(
#include <metal_stdlib>
using namespace metal;
kernel void k() {}
)";
NS::Error *Err = nullptr;
MTL::Library *Lib = Device->newLibrary(
NS::String::string(Src, NS::UTF8StringEncoding), nullptr, &Err);
if (!Lib) {
if (Err)
Err->release();
return 0;
}
MTL::Function *Func =
Lib->newFunction(NS::String::string("k", NS::UTF8StringEncoding));
Lib->release();
if (!Func)
return 0;
MTL::ComputePipelineState *PSO =
Device->newComputePipelineState(Func, &Err);
Func->release();
if (!PSO) {
if (Err)
Err->release();
return 0;
}
uint32_t SubgroupSize = PSO->threadExecutionWidth();
PSO->release();
return SubgroupSize;
}
void printExtra(llvm::raw_ostream &OS) override {
OS << " SubgroupSize: " << getSubgroupSize() << "\n";
}

std::pair<uint32_t, uint32_t> getMinMaxSubgroupSize() const override {
// Metal currently only exposes a single subgroup size.
const uint32_t SGSize = getSubgroupSize();
return {SGSize, SGSize};
}

const Capabilities &getCapabilities() override {
if (Caps.empty())
queryCapabilities();
Expand Down
31 changes: 30 additions & 1 deletion lib/API/VK/Device.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -322,9 +322,33 @@ class VKDevice : public offloadtest::Device {
VKDevice(const VKDevice &) = default;

~VKDevice() override = default;

llvm::StringRef getAPIName() const override { return "Vulkan"; }
GPUAPI getAPI() const override { return GPUAPI::Vulkan; }
uint32_t getSubgroupSize() const override {
VkPhysicalDeviceSubgroupProperties SubgroupProps = {};
SubgroupProps.sType = VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_SUBGROUP_PROPERTIES;

VkPhysicalDeviceProperties2 SubgroupProperties2 = {};
SubgroupProperties2.sType = VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_PROPERTIES_2;
SubgroupProperties2.pNext = &SubgroupProps;
vkGetPhysicalDeviceProperties2(Device, &SubgroupProperties2);
return SubgroupProps.subgroupSize;
}

std::pair<uint32_t, uint32_t> getMinMaxSubgroupSize() const override {
VkPhysicalDeviceSubgroupSizeControlPropertiesEXT SubgroupSizeControlProps =
{};
SubgroupSizeControlProps.sType =
VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_SUBGROUP_SIZE_CONTROL_PROPERTIES_EXT;

VkPhysicalDeviceProperties2 Props2 = {};
Props2.sType = VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_PROPERTIES_2;
Props2.pNext = &SubgroupSizeControlProps;

vkGetPhysicalDeviceProperties2(Device, &Props2);
return {SubgroupSizeControlProps.minSubgroupSize,
SubgroupSizeControlProps.maxSubgroupSize};
}

const Capabilities &getCapabilities() override {
if (Caps.empty())
Expand Down Expand Up @@ -361,6 +385,11 @@ class VKDevice : public offloadtest::Device {
}

void printExtra(llvm::raw_ostream &OS) override {
OS << " SubgroupSize: " << getSubgroupSize() << "\n";
auto MinMax = getMinMaxSubgroupSize();
OS << " MinSubgroupSize: " << MinMax.first << "\n";
OS << " MaxSubgroupSize: " << MinMax.second << "\n";

OS << " Layers:\n";
for (auto Layer : getLayers()) {
uint64_t Sz = strnlen(Layer.layerName, VK_MAX_EXTENSION_NAME_SIZE);
Expand Down
19 changes: 0 additions & 19 deletions lib/Support/Check.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -399,24 +399,5 @@ llvm::Error verifyResult(offloadtest::Result R) {
}
}

OS << "Expected:\n";
llvm::yaml::Output YAMLOS(OS);
YAMLOS << *R.ExpectedPtr;
OS << "Got:\n";
YAMLOS << *R.ActualPtr;

// Now print exact hex64 representations of each element of the
// actual and expected buffers.

const std::string ExpectedBufferStr =
getBufferStr(R.ExpectedPtr, R.ComparisonRule);
const std::string ActualBufferStr =
getBufferStr(R.ActualPtr, R.ComparisonRule);

OS << "Full Hex 64bit representation of Expected Buffer Values:\n"
<< ExpectedBufferStr << "\n";
OS << "Full Hex 64bit representation of Actual Buffer Values:\n"
<< ActualBufferStr << "\n";

return llvm::createStringError(Str.c_str());
}
120 changes: 120 additions & 0 deletions test/Feature/MaximalReconvergence/cts/tests/16/test_2_16_7_13_0.test

Large diffs are not rendered by default.

131 changes: 131 additions & 0 deletions test/Feature/MaximalReconvergence/cts/tests/16/test_2_16_7_13_1.test

Large diffs are not rendered by default.

109 changes: 109 additions & 0 deletions test/Feature/MaximalReconvergence/cts/tests/16/test_2_16_7_13_2.test

Large diffs are not rendered by default.

147 changes: 147 additions & 0 deletions test/Feature/MaximalReconvergence/cts/tests/16/test_2_16_7_13_3.test

Large diffs are not rendered by default.

118 changes: 118 additions & 0 deletions test/Feature/MaximalReconvergence/cts/tests/16/test_2_16_7_13_4.test

Large diffs are not rendered by default.

116 changes: 116 additions & 0 deletions test/Feature/MaximalReconvergence/cts/tests/16/test_2_16_7_13_5.test

Large diffs are not rendered by default.

Loading
Loading