Repository navigation
cv-utils: add several Triton kernels - #1182
Conversation
|
This PR changes source code for the following kernel(s): If you have the kernel-bot build permissions, then trigger |
|
/kernel-bot build-and-stage cv-utils |
|
Build request processed. Command: Dispatched (1):
Hub uploads: |
|
Lmk when I should review @molbap 🫡 |
|
I think you can review now @vasqu ! |
|
/kernel-bot build-and-stage cv-utils |
|
Build request processed. Command: Dispatched (1):
Hub uploads: |
|
/kernel-bot build-and-stage cv-utils |
|
Build request processed. Command: Dispatched (1):
Hub uploads: |
|
/kernel-bot build-and-stage cv-utils |
|
Build request processed. Command: Dispatched (1):
Hub uploads: |
|
/kernel-bot build-and-stage cv-utils |
|
Build request processed. Command: Dispatched (1):
Hub uploads: |
There was a problem hiding this comment.
lgtm!
planning to optimistically merge this PR after a small CI fix that is causing the min torch version ci job seen here https://github.com/huggingface/kernels-community/actions/runs/41133285042/job/124352993673#step:9:30
**update: pr to resolve opened here
rational for merging - build and tests look good, this pr adds functionality and has been open for >1 month. happy to hold off for any reason
this pr fixes the `test-kernel-minimum-torch` job for stable abi kernels that run triton in their tests (first hit on #1182 https://github.com/huggingface/kernels-community/actions/runs/41133285042/job/124352993673) tldr; `uv venv` picks the runner's system python which has no headers, so triton fails to compile its launcher with `Python.h: No such file or directory`. the venv now uses `--managed-python`, which ships with headers repro in an ubuntu 24.04 container with the system python and no `python3.12-dev`, running the #1182 tests before 44 failed, 92 passed, 4 skipped after 136 passed, 4 skipped note: the repro ran on rocm (mi300x) so triton compiles `hip_utils.c` instead of `cuda_utils.c`, same `Python.h` include. #1182 needs a rebuild after this is merged since the workflow runs from main
|
/kernel-bot merge-and-upload cv-utils |
|
Build request failed. Command: Failure: Failed to merge PR before build/upload. Check mergeability and required checks. |
|
/kernel-bot merge-and-upload cv-utils |
|
Build request failed. Command: Failure: Failed to merge PR before build/upload. Check mergeability and required checks. |
|
/kernel-bot merge-and-upload cv-utils |
|
Build request processed. Command: Merge result: PR is already merged. Continuing with build/upload. Dispatched (1):
Hub uploads: |
this pr fixes the `test-kernel-rocm` job for kernels that run triton in their tests (first hit on #1320 https://github.com/huggingface/kernels-community/actions/runs/43476728896/job/132069439103) tldr; the job runs in a bare `ubuntu:24.04` container with no compiler, so triton fails to build its launcher with `RuntimeError: Failed to find C compiler`. the base packages step now also installs `gcc` and `libc6-dev` (`--no-install-recommends` skips the libc headers otherwise) same #1182 cv-utils tests as #1318, `44 failed, 92 passed, 4 skipped`, but a missing compiler instead of missing `Python.h` (the nix ci-test python has headers). the cuda runners have a host gcc so `test-kernel-gpu` passes note: #1320 and #1329 need a rebuild after this is merged since the workflow runs from main
this pr adds a rocm build for `cv-utils` same change as causal-conv1d in #1319: the `rocm` backend, `rocm = "2.10"` stable abi and a `cpp-rocm` kernel with the same sources and `activation` archs, and `stable_utils.h` picks the hip runtime under `USE_ROCM`. the kernels have no warp intrinsics and nms already uses 64 bit masks, so no kernel changes. the triton functions from #1182 run on rocm as is built all rocm variants (`rocm70`, `rocm71`, `rocm714`, `rocm72`, `rocm100`) and ran the tests on mi300x (gfx942) with torch `2.10.0+rocm7.0`, `2.12.1+rocm7.1` and `2.14.1+rocm7.2`, 136 pass on each (4 skipped, they need two gpus). `generic_nms` keeps the same boxes as `torchvision.ops.nms` on rocm at 1k, 5k and 20k boxes and is within 4% of its speed note: this lands in v2, sam3 video still loads `version=1` so transformers needs to bump that before it picks up the rocm build. no version bump here since this only adds a backend *keeping as draft until ci support rocm - #1313 --------- Signed-off-by: David Holtz <david.richard.holtz@gmail.com>
This adds Triton functions to cv-utils for pre- and post-processing in transformers.
The transformers side is github.com/huggingface/transformers/pull/46771, where image processors call these kernels with use_kernels=True.
This bumps cv-utils to v2. Tests compare against torch.nn.functional.interpolate and are in the kernels_ci subset.