Skip to content

Commit aceeb40

Browse files
authored
addon for cuda support (pytorch#20822)
Differential Revision: D110282210 Pull Request resolved: pytorch#20822
1 parent ec9d6e2 commit aceeb40

4 files changed

Lines changed: 80 additions & 1 deletion

File tree

backends/cuda/TARGETS

Lines changed: 46 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,20 +3,64 @@ load("@fbsource//xplat/executorch/build:runtime_wrapper.bzl", "runtime")
33
oncall("executorch")
44

55
runtime.python_library(
6-
name = "quantize_op_dispatch",
6+
name = "coalesced_int4_tensor",
77
srcs = [
88
"coalesced_int4_tensor.py",
9+
],
10+
visibility = [
11+
"//executorch/...",
12+
],
13+
deps = [
14+
"//caffe2:torch",
15+
"//pytorch/ao:torchao",
16+
],
17+
)
18+
19+
runtime.python_library(
20+
name = "dp4a_planar_int5_tensor",
21+
srcs = [
22+
"dp4a_planar_int5_tensor.py",
23+
],
24+
visibility = [
25+
"//executorch/...",
26+
],
27+
deps = [
28+
"//caffe2:torch",
29+
"//pytorch/ao:torchao",
30+
],
31+
)
32+
33+
runtime.python_library(
34+
name = "dp4a_planar_int6_tensor",
35+
srcs = [
936
"dp4a_planar_int6_tensor.py",
37+
],
38+
visibility = [
39+
"//executorch/...",
40+
],
41+
deps = [
42+
"//caffe2:torch",
43+
"//pytorch/ao:torchao",
44+
],
45+
)
46+
47+
runtime.python_library(
48+
name = "quantize_op_dispatch",
49+
srcs = [
1050
"quantize_op_dispatch/__init__.py",
1151
"quantize_op_dispatch/_library.py",
1252
"quantize_op_dispatch/int4_dispatch.py",
53+
"quantize_op_dispatch/int5_dispatch.py",
1354
"quantize_op_dispatch/int6_dispatch.py",
1455
"quantize_op_dispatch/int8_dispatch.py",
1556
],
1657
visibility = [
1758
"//executorch/...",
1859
],
1960
deps = [
61+
":coalesced_int4_tensor",
62+
":dp4a_planar_int5_tensor",
63+
":dp4a_planar_int6_tensor",
2064
"//caffe2:torch",
2165
"//pytorch/ao:torchao",
2266
],
@@ -80,6 +124,7 @@ runtime.python_library(
80124
"triton/kernels/int4_matmul.py",
81125
"triton/kernels/sdpa.py",
82126
"triton/kernels/topk.py",
127+
"triton/kernels/tq4_sdpa.py",
83128
],
84129
visibility = [
85130
"//executorch/backends/cuda/...",

backends/cuda/cuda_backend.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -385,6 +385,8 @@ def get_supported_fallback_kernels(cls) -> Dict[str, Any]:
385385
"aoti_torch_cuda_randint_low_out": None,
386386
"executorch_cuda::int4_plain_mm": None,
387387
"aoti_torch_cuda_int4_plain_mm": None,
388+
"executorch_cuda::int5_plain_mm": None,
389+
"aoti_torch_cuda_int5_plain_mm": None,
388390
"executorch_cuda::int6_plain_mm": None,
389391
"aoti_torch_cuda_int6_plain_mm": None,
390392
"executorch_cuda::int8_plain_mm": None,

extension/llm/export/BUCK

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -59,6 +59,26 @@ fbcode_target(_kind = runtime.python_library,
5959
],
6060
)
6161

62+
fbcode_target(_kind = runtime.python_library,
63+
name = "gguf",
64+
srcs = [
65+
"gguf.py",
66+
],
67+
_is_external_target = True,
68+
base_module = "executorch.extension.llm.export",
69+
visibility = [
70+
"//executorch/backends/...",
71+
"//executorch/examples/...",
72+
"//executorch/extension/llm/...",
73+
],
74+
deps = [
75+
"//caffe2:torch",
76+
"//pytorch/ao:torchao",
77+
"fbsource//third-party/pypi/gguf:gguf",
78+
"fbsource//third-party/pypi/numpy:numpy",
79+
],
80+
)
81+
6282
fbcode_target(_kind = runtime.python_binary,
6383
name = "export_llm",
6484
srcs = [

extension/llm/modules/BUCK

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,18 @@ fbcode_target(_kind = runtime.python_library,
3737
],
3838
)
3939

40+
fbcode_target(_kind = runtime.python_library,
41+
name = "turboquant",
42+
srcs = [
43+
"turboquant/__init__.py",
44+
"turboquant/codebook.py",
45+
"turboquant/kv_cache.py",
46+
],
47+
deps = [
48+
"//caffe2:torch",
49+
],
50+
)
51+
4052
fbcode_target(_kind = runtime.python_library,
4153
name = "module_lib",
4254
srcs = [

0 commit comments

Comments
 (0)