oneapi-src / oneapi-src/unified-runtime

Clarify semantics of `urKernelSuggestMaxCooperativeGroupCountExp`

Open
#1,687 11 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

cuda experimental hip level-zero
Dominant language
C++
Stars
57
Forks
120
Avg merge
1d 14h
Merged PRs (30d)
1

Description

CC @0x12CC @nrspruit

In the discussion from here: https://github.com/oneapi-src/unified-runtime/pull/1246#issuecomment-1894446658

it was described that urKernelSuggestMaxCooperativeGroupCountExp maps to cudaOccupancyMaxActiveBlocksPerMultiprocessor
which takes a kernel and other params, and returns the maximum number of blocks that can be simultaneously executed in a streaming multiprocessor (SM).

However I found this in the l0 documentation:

"Use zeKernelSuggestMaxCooperativeGroupCount to recommend max group count for device for cooperative functions that device supports."

The "device" word implies that the semantics of of urKernelSuggestMaxCooperativeGroupCountExp is the maximum number of blocks that can be simultaneously executed in a device. A device consists of multiple streaming multiprocessors. In such a case you need to multiply the max number of blocks that can be simultanously executed in a SM by the number of SMs in a device.

The number of SMs can only be retrieved by querying the device the kernel is to be run on. This information (the device to be run on) is not passed to urKernelSuggestMaxCooperativeGroupCountExp, nor can it be inferred from any of the other parameters.
Therefore, there are two possibilities:

  • if the semantics is the max number of blocks per device, the interface needs to be changed.
  • if the semantics is the max number of blocks per SM, the documentation should be clarified IMO.

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with the discussion in PR #1246 and the Level Zero zeKernelSuggestMaxCooperativeGroupCount documentation, then inspect the urKernelSuggestMaxCooperativeGroupCountExp API definition and its existing documentation. Done means the per-device versus per-SM semantics are resolved and the API or documentation is updated accordingly.

Written by the indexing model from the issue text.

Assessment

Tech stack
cpp
Domain
api, documentation
Issue type
Documentation
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
30/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.