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
5 changes: 3 additions & 2 deletions third_party/amd/backend/driver.c
Original file line number Diff line number Diff line change
Expand Up @@ -309,12 +309,13 @@ static PyObject *getDeviceProperties(PyObject *self, PyObject *args) {

// create a struct to hold device properties
return Py_BuildValue(
"{s:i, s:i, s:i, s:i, s:i, s:i, s:s, s:i, s:i}", "max_shared_mem",
"{s:i, s:i, s:i, s:i, s:i, s:i, s:s, s:i, s:i, s:i}", "max_shared_mem",
props.sharedMemPerBlock, "max_num_regs", props.regsPerBlock,
"multiprocessor_count", props.multiProcessorCount, "sm_clock_rate",
props.clockRate, "mem_clock_rate", props.memoryClockRate, "mem_bus_width",
props.memoryBusWidth, "arch", props.gcnArchName, "warpSize",
props.warpSize, "max_threads_per_sm", props.maxThreadsPerMultiProcessor);
props.warpSize, "max_threads_per_sm", props.maxThreadsPerMultiProcessor,
"cooperativeLaunch", props.cooperativeLaunch);
}

static PyObject *loadBinary(PyObject *self, PyObject *args) {
Expand Down
7 changes: 7 additions & 0 deletions third_party/amd/backend/driver.py
Original file line number Diff line number Diff line change
Expand Up @@ -809,6 +809,13 @@ def __init__(self, src, metadata):
mod = compile_module_from_src(src=src, name="__triton_launcher", include_dirs=include_dirs)
self.launch = wrap_handle_tensordesc(mod.launch, signature, tensordesc_meta)
self.launch_cooperative_grid = metadata.launch_cooperative_grid
# Check if cooperative groups are supported on the device.
if self.launch_cooperative_grid:
driver = triton.runtime.driver.active
assert isinstance(driver, HIPDriver)
device = driver.get_current_device()
device_properties = driver.utils.get_device_properties(device)
self.launch_cooperative_grid = device_properties['cooperativeLaunch']
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We should assert the device supports cooperative launch here instead of silently overwriting what the developer said. Rationale being that the developer indicates they want cooperative launch. That's likely due to some forward progress needs which demands certain number of blocks to co-launch. By silently overwriting that it can be a big suprise for developers to see hangs or incorrect results. In general, if reality doesn't match with what the developer explicitly said, better to be noisy and error out than "correct" it under the hood for developer.

self.profile_scratch_size = metadata.profile_scratch_size
self.profile_scratch_align = metadata.profile_scratch_align

Expand Down