Skip to content

Commit caf79c1

Browse files
committed
mcv: fix pre-commit issues
Signed-off-by: Maryam Tahhan <mtahhan@redhat.com>
1 parent 0b4cd89 commit caf79c1

File tree

4 files changed

+169
-95
lines changed

4 files changed

+169
-95
lines changed

mcv/README.md

Lines changed: 67 additions & 43 deletions
Original file line numberDiff line numberDiff line change
@@ -63,13 +63,15 @@ Flags:
6363
-e, --extract Extract a cache from an OCI image
6464
-h, --help help for mcv
6565
-i, --image string OCI image name
66-
-l, --log-level string Set the logging verbosity level: debug, info, warning or error
67-
--no-gpu Allow kernel extraction without GPU present (for testing purposes)
66+
-l, --log-level string Set the logging verbosity level:
67+
debug, info, warning or error
68+
--no-gpu Allow kernel extraction without GPU
69+
present (for testing purposes)
6870
```
6971

7072
> NOTE: The create option is a work in progress.
71-
> For now to create an OCI image containing a GPU Kernel cache directory please
72-
> follow the instructions in [spec-compat.md](./docs/spec-compat.md).
73+
> For now to create an OCI image containing a GPU Kernel cache directory
74+
> please follow the instructions in [spec-compat.md](./docs/spec-compat.md).
7375
7476
## Dependencies
7577

@@ -79,16 +81,19 @@ Flags:
7981

8082
### Cache Image Container Specification
8183

82-
The Cache Image specification defines how to bundle caches
83-
as container images. A compatible Cache image consists of cache
84-
directory for a Triton Kernel/vLLM model. The details can be found in
84+
The Cache Image specification defines how to bundle caches as container
85+
images. A compatible Cache image consists of cache directory for a Triton
86+
Kernel/vLLM model. The details can be found in
8587
[spec-compat.md](./docs/spec-compat.md)
8688

8789
### vLLM Binary Cache Support
8890

8991
MCV supports both legacy (triton cache) and new (binary cache) vLLM formats:
90-
1. **vLLM Triton Cache Format** (legacy) - Stores `triton_cache/` and `inductor_cache/` inside rank directories
91-
2. **vLLM Binary Cache Format** (new) - Stores prefix directories (e.g., `backbone/`) inside rank directories
92+
93+
1. **vLLM Triton Cache Format** (legacy) - Stores `triton_cache/` and
94+
`inductor_cache/` inside rank directories
95+
2. **vLLM Binary Cache Format** (new) - Stores prefix directories
96+
(e.g., `backbone/`) inside rank directories
9297

9398
For detailed information about vLLM binary cache support, see:
9499
[vllm-binary-cache.md](./docs/vllm-binary-cache.md)
@@ -97,7 +102,8 @@ For detailed information about vLLM binary cache support, see:
97102

98103
To extract the Triton Cache for the
99104
[01-vector-add.py](https://github.com/triton-lang/triton/blob/main/python/tutorials/01-vector-add.py)
100-
tutorial from [Triton](https://github.com/triton-lang/triton), run the following:
105+
tutorial from [Triton](https://github.com/triton-lang/triton), run the
106+
following:
101107

102108
```bash
103109
mcv -e -i quay.io/gkm/vector-add-cache:rocm
@@ -107,10 +113,12 @@ Img Size: 525
107113
bash-4.4#
108114
```
109115

110-
This will extract the cache directory from the `quay.io/gkm/vector-add-cache:rocm`
111-
container image and copy it to `~/.triton/cache/`.
116+
This will extract the cache directory from the
117+
`quay.io/gkm/vector-add-cache:rocm` container image and copy it to
118+
`~/.triton/cache/`.
112119

113-
To Create an OCI image for a Triton Cache using docker run the following:
120+
To Create an OCI image for a Triton Cache using docker run the
121+
following:
114122

115123
```bash
116124
mcv -c -i quay.io/gkm/vector-add-cache:rocm -d example/vector-add-cache-rocm
@@ -334,12 +342,22 @@ cosign sign -y quay.io/tkm/vector-add-cache@sha256:<digest>
334342
Generating ephemeral keys...
335343
Retrieving signed certificate...
336344

337-
The sigstore service, hosted by sigstore a Series of LF Projects, LLC, is provided pursuant to the Hosted Project Tools Terms of Use, available at https://lfprojects.org/policies/hosted-project-tools-terms-of-use/.
338-
Note that if your submission includes personal data associated with this signed artifact, it will be part of an immutable record.
339-
This may include the email address associated with the account with which you authenticate your contractual Agreement.
340-
This information will be used for signing this artifact and will be stored in public transparency logs and cannot be removed later, and is subject to the Immutable Record notice at https://lfprojects.org/policies/hosted-project-tools-immutable-records/.
341-
342-
By typing 'y', you attest that (1) you are not submitting the personal data of any other person; and (2) you understand and agree to the statement and the Agreement terms at the URLs listed above.
345+
The sigstore service, hosted by sigstore a Series of LF Projects,
346+
LLC, is provided pursuant to the Hosted Project Tools Terms of
347+
Use, available at
348+
https://lfprojects.org/policies/hosted-project-tools-terms-of-use/.
349+
Note that if your submission includes personal data associated with
350+
this signed artifact, it will be part of an immutable record.
351+
This may include the email address associated with the account with
352+
which you authenticate your contractual Agreement.
353+
This information will be used for signing this artifact and will be
354+
stored in public transparency logs and cannot be removed later, and
355+
is subject to the Immutable Record notice at
356+
https://lfprojects.org/policies/hosted-project-tools-immutable-records/.
357+
358+
By typing 'y', you attest that (1) you are not submitting the personal
359+
data of any other person; and (2) you understand and agree to the
360+
statement and the Agreement terms at the URLs listed above.
343361
Your browser will now be opened to:
344362
...
345363
```
@@ -364,8 +382,8 @@ Pushing signature to: quay.io/mtahhan/01-vector-add-cache
364382
365383
### Extracting a Cache from a Container Image
366384
367-
An example snippet of how to use the client API to extract a Cache
368-
from a container image is shown below.
385+
An example snippet of how to use the client API to extract a Cache from a
386+
container image is shown below.
369387
370388
```go
371389
import (
@@ -437,21 +455,24 @@ import (
437455
)
438456

439457
func main() {
440-
matched, unmatched, err := client.PreflightCheck("quay.io/mtahhan/01-vector-add-cache:latest")
458+
matched, unmatched, err := client.PreflightCheck(
459+
"quay.io/mtahhan/01-vector-add-cache:latest")
441460
if err != nil {
442461
log.Fatalf("Preflight check failed: %v", err)
443462
}
444463

445464
fmt.Printf("Compatible GPUs: %d\n", len(matched))
446465
for i, gpu := range matched {
447-
fmt.Printf(" MATCH %d: Backend=%s, Arch=%s, WarpSize=%d, PTX=%s\n",
448-
i, gpu.Backend, gpu.Arch, gpu.WarpSize, gpu.PTXVersion)
466+
fmt.Printf(" MATCH %d: Backend=%s, Arch=%s, WarpSize=%d, "+
467+
"PTX=%s\n", i, gpu.Backend, gpu.Arch, gpu.WarpSize,
468+
gpu.PTXVersion)
449469
}
450470

451471
fmt.Printf("Incompatible GPUs: %d\n", len(unmatched))
452472
for i, gpu := range unmatched {
453-
fmt.Printf(" NO-MATCH %d: Backend=%s, Arch=%s, WarpSize=%d, PTX=%s\n",
454-
i, gpu.Backend, gpu.Arch, gpu.WarpSize, gpu.PTXVersion)
473+
fmt.Printf(" NO-MATCH %d: Backend=%s, Arch=%s, WarpSize=%d, "+
474+
"PTX=%s\n", i, gpu.Backend, gpu.Arch, gpu.WarpSize,
475+
gpu.PTXVersion)
455476
}
456477
}
457478
```
@@ -463,29 +484,30 @@ configuration. This is useful for testing or CI environments.
463484
464485
#### Stub Mode Usage
465486
466-
Run MCV with the `--stub` flag. It will use the static config and behave as if those
467-
devices are present.
487+
Run MCV with the `--stub` flag. It will use the static config and behave as
488+
if those devices are present.
468489
469490
## Using MCV image to build cache images
470491
471-
MCV provides a container image called `quay.io/gkm/mcv`. This image
472-
can be used to wrap a vLLM/Triton cache in an OCI container image
473-
that can then be pushed to a container registry (without having
474-
to install mcv locally). This image can also be used as part
475-
of a [github workflow](./.github/workflows/mcv-build-example-images.yml).
492+
MCV provides a container image called `quay.io/gkm/mcv`. This image can be
493+
used to wrap a vLLM/Triton cache in an OCI container image that can then be
494+
pushed to a container registry (without having to install mcv locally). This
495+
image can also be used as part of a
496+
[github workflow](./.github/workflows/mcv-build-example-images.yml).
476497
477498
### MCV container image with docker
478499
479-
To use docker on the host with an MCV image, you need to
480-
mount the cache directory to the container and run the following command:
500+
To use docker on the host with an MCV image, you need to mount the cache
501+
directory to the container and run the following command:
481502
482503
```bash
483504
docker run --rm -it --privileged \
484505
-v <path-to-cache>/example:/example \
485506
quay.io/gkm/mcv bash -lc '
486-
/mcv -c -i quay.io/gkm/vector-add-cache:rocm -d /example/vector-add-cache-rocm &&
507+
/mcv -c -i quay.io/gkm/vector-add-cache:rocm \
508+
-d /example/vector-add-cache-rocm &&
487509
buildah push containers-storage:quay.io/gkm/vector-add-cache:rocm \
488-
docker-archive:/example/vector-add-cache-rocm.tar:quay.io/gkm/vector-add-cache:rocm
510+
docker-archive:/example/vector-add-cache-rocm.tar:quay.io/gkm/vector-add-cache:rocm
489511
'
490512
INFO[2025-09-11 16:46:54] Setting log level: info
491513
INFO[2025-09-11 16:46:54] Using buildah to build the image
@@ -503,8 +525,9 @@ Then on host:
503525
504526
```bash
505527
docker load -i <path-to-cache>/example/vector-add-cache-rocm.tar
506-
24b82d6fef87: Loading layer [==================================================>] 93.18kB/93.18kB
507-
The image quay.io/gkm/vector-add-cache:rocm already exists, renaming the old one with ID sha256:5dc90b88f536e44e186c5a076afbb7a54389aed6f0ddfa21365ae2c7f79cb21d to empty string
528+
24b82d6fef87: Loading layer 93.18kB/93.18kB
529+
The image quay.io/gkm/vector-add-cache:rocm already exists, renaming
530+
the old one with ID sha256:5dc90b88f536e44e186c5a076afbb7a54389aed6f0ddfa21365ae2c7f79cb21d to empty string
508531
Loaded image: quay.io/gkm/vector-add-cache:rocm
509532
```
510533
@@ -518,16 +541,17 @@ quay.io/gkm/vector-add-cache rocm 8ce4bc2e98ab 15 seconds ago
518541
519542
### MCV container image with podman
520543
521-
To use podman on the host with an MCV image, you need to
522-
mount the cache directory to the container and run the following command:
544+
To use podman on the host with an MCV image, you need to mount the cache
545+
directory to the container and run the following command:
523546
524547
```bash
525548
podman run --rm -it --privileged \
526549
-v <path-to-cache>/example:/example \
527550
quay.io/gkm/mcv bash -lc '
528-
/mcv -c -i quay.io/gkm/vector-add-cache:rocm -d /example/vector-add-cache-rocm &&
551+
/mcv -c -i quay.io/gkm/vector-add-cache:rocm \
552+
-d /example/vector-add-cache-rocm &&
529553
buildah push containers-storage:quay.io/gkm/vector-add-cache:rocm \
530-
oci-archive:/example/vector-add-cache-rocm.oci:quay.io/gkm/vector-add-cache:rocm
554+
oci-archive:/example/vector-add-cache-rocm.oci:quay.io/gkm/vector-add-cache:rocm
531555
'
532556
```
533557

0 commit comments

Comments
 (0)