Upload 3 files
Browse files
.gitattributes
CHANGED
@@ -33,3 +33,4 @@ saved_model/**/* filter=lfs diff=lfs merge=lfs -text
|
|
33 |
*.zip filter=lfs diff=lfs merge=lfs -text
|
34 |
*.zst filter=lfs diff=lfs merge=lfs -text
|
35 |
*tfevents* filter=lfs diff=lfs merge=lfs -text
|
|
|
|
33 |
*.zip filter=lfs diff=lfs merge=lfs -text
|
34 |
*.zst filter=lfs diff=lfs merge=lfs -text
|
35 |
*tfevents* filter=lfs diff=lfs merge=lfs -text
|
36 |
+
build/torch27-cxx11-rocm63-x86_64-linux/aiter_cache/_aiter_cache_a120ba4f5566b.so filter=lfs diff=lfs merge=lfs -text
|
build/torch27-cxx11-rocm63-x86_64-linux/aiter_cache/__init__.py
ADDED
@@ -0,0 +1,74 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
# This is a Python package for the kernel.
|
2 |
+
from ._ops import ops
|
3 |
+
# SPDX-License-Identifier: MIT
|
4 |
+
# Copyright (c) 2024, Advanced Micro Devices, Inc. All rights reserved.
|
5 |
+
|
6 |
+
from torch import Tensor
|
7 |
+
from typing import List, Optional
|
8 |
+
from ..jit.core import compile_ops, CK_DIR, AITER_CSRC_DIR
|
9 |
+
import torch.nn.functional as F
|
10 |
+
|
11 |
+
MD_NAME = "module_cache"
|
12 |
+
|
13 |
+
|
14 |
+
def swap_blocks(src: Tensor, dst: Tensor, block_mapping: Tensor):
|
15 |
+
return ops.swap_blocks(src, dst, block_mapping)
|
16 |
+
|
17 |
+
def copy_blocks(key_caches: Tensor, value_caches: Tensor, block_mapping: Tensor):
|
18 |
+
return ops.copy_blocks(key_caches, value_caches, block_mapping)
|
19 |
+
|
20 |
+
def reshape_and_cache(
|
21 |
+
key: Tensor,
|
22 |
+
value: Tensor,
|
23 |
+
key_cache: Tensor,
|
24 |
+
value_cache: Tensor,
|
25 |
+
slot_mapping: Tensor,
|
26 |
+
kv_cache_dtype: str,
|
27 |
+
k_scale: float,
|
28 |
+
v_scale: float,
|
29 |
+
asm_layout: bool,
|
30 |
+
):
|
31 |
+
return ops.reshape_and_cache(
|
32 |
+
key, value, key_cache, value_cache, slot_mapping, kv_cache_dtype, k_scale, v_scale, asm_layout
|
33 |
+
)
|
34 |
+
|
35 |
+
def reshape_and_cache_flash(
|
36 |
+
key: Tensor,
|
37 |
+
value: Tensor,
|
38 |
+
key_cache: Tensor,
|
39 |
+
value_cache: Tensor,
|
40 |
+
slot_mapping: Tensor,
|
41 |
+
kv_cache_dtype: str,
|
42 |
+
k_scale: float,
|
43 |
+
v_scale: float,
|
44 |
+
):
|
45 |
+
return ops.reshape_and_cache_flash(
|
46 |
+
key, value, key_cache, value_cache, slot_mapping, kv_cache_dtype, k_scale, v_scale
|
47 |
+
)
|
48 |
+
|
49 |
+
def reshape_and_cache_with_pertoken_quant(
|
50 |
+
key: Tensor,
|
51 |
+
value: Tensor,
|
52 |
+
key_cache: Tensor,
|
53 |
+
value_cache: Tensor,
|
54 |
+
k_dequant_scales: Tensor,
|
55 |
+
v_dequant_scales: Tensor,
|
56 |
+
slot_mapping: Tensor,
|
57 |
+
asm_layout: bool,
|
58 |
+
):
|
59 |
+
return ops.reshape_and_cache_with_pertoken_quant(
|
60 |
+
key, value, key_cache, value_cache, k_dequant_scales, v_dequant_scales, slot_mapping, asm_layout
|
61 |
+
)
|
62 |
+
|
63 |
+
def convert_fp8(dst_cache: Tensor, src_cache: Tensor, scale: float, kv_cache_dtype: str):
|
64 |
+
return ops.convert_fp8(dst_cache, src_cache, scale, kv_cache_dtype)
|
65 |
+
|
66 |
+
|
67 |
+
__all__ = [
|
68 |
+
"swap_blocks",
|
69 |
+
"copy_blocks",
|
70 |
+
"reshape_and_cache",
|
71 |
+
"reshape_and_cache_flash",
|
72 |
+
"reshape_and_cache_with_pertoken_quant",
|
73 |
+
"convert_fp8",
|
74 |
+
]
|
build/torch27-cxx11-rocm63-x86_64-linux/aiter_cache/_aiter_cache_a120ba4f5566b.so
ADDED
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
1 |
+
version https://git-lfs.github.com/spec/v1
|
2 |
+
oid sha256:90b336720d27099a02e321d13a67c5e81caeb5c956d76ee21752434521fd57f0
|
3 |
+
size 2371744
|
build/torch27-cxx11-rocm63-x86_64-linux/aiter_cache/_ops.py
ADDED
@@ -0,0 +1,9 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
import torch
|
2 |
+
from . import _aiter_cache_a120ba4f5566b
|
3 |
+
ops = torch.ops._aiter_cache_a120ba4f5566b
|
4 |
+
|
5 |
+
def add_op_namespace_prefix(op_name: str):
|
6 |
+
"""
|
7 |
+
Prefix op by namespace.
|
8 |
+
"""
|
9 |
+
return f"_aiter_cache_a120ba4f5566b::{op_name}"
|