Skip to content

Commit

Permalink
CL/Vulkan: regionOffset as GWO for uniform
Browse files Browse the repository at this point in the history
clspv states:
    region_offset: the sum of the global ID
    offset into the NDRange for this uniform
    region and the global offset of the NDRange

Since we currently do not support non-uniform at
the moment, we just treat the
PushConstantRegionOffset as the global work offset.

Bug: angleproject:366412385
Change-Id: Ifd9953f21cd7826198b2cfe7d30ddec68ea2c7a0
Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/5860309
Reviewed-by: Geoff Lang <[email protected]>
Reviewed-by: Shahbaz Youssefi <[email protected]>
Commit-Queue: Shahbaz Youssefi <[email protected]>
  • Loading branch information
annestrand authored and Angle LUCI CQ committed Sep 20, 2024
1 parent 741e535 commit cce1497
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 0 deletions.
12 changes: 12 additions & 0 deletions src/libANGLE/renderer/vulkan/CLCommandQueueVk.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -613,6 +613,18 @@ angle::Result CLCommandQueueVk::processKernelResources(CLKernelVk &kernelVk,
globalSizeRange->offset, globalSizeRange->size, ndrange.globalWorkSize.data());
}

// Push region offset data.
const VkPushConstantRange *regionOffsetRange = devProgramData->getRegionOffsetRange();
if (regionOffsetRange != nullptr)
{
// We dont support non-uniform batches yet in ANGLE, this field also represents global
// offset for NDR in uniform cases. Update this when non-uniform batches are supported.
// https://github.com/google/clspv/blob/main/docs/OpenCLCOnVulkan.md#module-scope-push-constants
mComputePassCommands->getCommandBuffer().pushConstants(
kernelVk.getPipelineLayout().get(), VK_SHADER_STAGE_COMPUTE_BIT,
regionOffsetRange->offset, regionOffsetRange->size, ndrange.globalWorkOffset.data());
}

// Push enqueued local size
const VkPushConstantRange *enqueuedLocalSizeRange = devProgramData->getEnqueuedLocalSizeRange();
if (enqueuedLocalSizeRange != nullptr)
Expand Down
6 changes: 6 additions & 0 deletions src/libANGLE/renderer/vulkan/CLProgramVk.h
Original file line number Diff line number Diff line change
Expand Up @@ -196,6 +196,12 @@ class CLProgramVk : public CLProgramImpl
return getPushConstantRangeFromClspvReflectionType(
NonSemanticClspvReflectionPushConstantNumWorkgroups);
}

inline const VkPushConstantRange *getRegionOffsetRange() const
{
return getPushConstantRangeFromClspvReflectionType(
NonSemanticClspvReflectionPushConstantRegionOffset);
}
};
using DevicePrograms = angle::HashMap<const _cl_device_id *, DeviceProgramData>;
using LinkPrograms = std::vector<const DeviceProgramData *>;
Expand Down

0 comments on commit cce1497

Please sign in to comment.