liangsu9988 commited on
Commit
af4f1aa
·
verified ·
1 Parent(s): b3874be

Uploaded using `kernel-builder`.

Browse files
Files changed (37) hide show
  1. benchmarks/benchmark_linear_bias.py +338 -0
  2. build/torch211-cxx11-cu128-x86_64-linux/__init__.py +112 -0
  3. build/torch211-cxx11-cu128-x86_64-linux/{_flashrt_fp8_ffn_cuda_1b7b2db.abi3.so → _flashrt_fp8_ffn_cuda_255584f.abi3.so} +2 -2
  4. build/torch211-cxx11-cu128-x86_64-linux/_ops.py +3 -3
  5. build/torch211-cxx11-cu128-x86_64-linux/metadata.json +1 -1
  6. build/torch211-cxx11-cu130-x86_64-linux/__init__.py +112 -0
  7. build/torch211-cxx11-cu130-x86_64-linux/{_flashrt_fp8_ffn_cuda_1b7b2db.abi3.so → _flashrt_fp8_ffn_cuda_255584f.abi3.so} +2 -2
  8. build/torch211-cxx11-cu130-x86_64-linux/_ops.py +3 -3
  9. build/torch211-cxx11-cu130-x86_64-linux/metadata.json +1 -1
  10. build/torch211-cxx11-rocm71-x86_64-linux/__init__.py +112 -0
  11. build/torch211-cxx11-rocm71-x86_64-linux/{_flashrt_fp8_ffn_rocm_1b7b2db.abi3.so → _flashrt_fp8_ffn_rocm_255584f.abi3.so} +2 -2
  12. build/torch211-cxx11-rocm71-x86_64-linux/_ops.py +3 -3
  13. build/torch211-cxx11-rocm71-x86_64-linux/metadata.json +1 -1
  14. build/torch211-cxx11-rocm72-x86_64-linux/__init__.py +112 -0
  15. build/torch211-cxx11-rocm72-x86_64-linux/{_flashrt_fp8_ffn_rocm_1b7b2db.abi3.so → _flashrt_fp8_ffn_rocm_255584f.abi3.so} +2 -2
  16. build/torch211-cxx11-rocm72-x86_64-linux/_ops.py +3 -3
  17. build/torch211-cxx11-rocm72-x86_64-linux/metadata.json +1 -1
  18. build/torch212-cxx11-cu130-x86_64-linux/__init__.py +112 -0
  19. build/torch212-cxx11-cu130-x86_64-linux/_flashrt_fp8_ffn_cuda_1b7b2db.abi3.so +0 -3
  20. build/torch212-cxx11-cu130-x86_64-linux/_flashrt_fp8_ffn_cuda_255584f.abi3.so +3 -0
  21. build/torch212-cxx11-cu130-x86_64-linux/_ops.py +3 -3
  22. build/torch212-cxx11-cu130-x86_64-linux/metadata.json +1 -1
  23. build/torch212-cxx11-cu132-x86_64-linux/__init__.py +112 -0
  24. build/torch212-cxx11-cu132-x86_64-linux/_flashrt_fp8_ffn_cuda_1b7b2db.abi3.so +0 -3
  25. build/torch212-cxx11-cu132-x86_64-linux/_flashrt_fp8_ffn_cuda_255584f.abi3.so +3 -0
  26. build/torch212-cxx11-cu132-x86_64-linux/_ops.py +3 -3
  27. build/torch212-cxx11-cu132-x86_64-linux/metadata.json +1 -1
  28. build/torch212-cxx11-rocm71-x86_64-linux/__init__.py +112 -0
  29. build/torch212-cxx11-rocm71-x86_64-linux/_flashrt_fp8_ffn_rocm_1b7b2db.abi3.so +0 -3
  30. build/torch212-cxx11-rocm71-x86_64-linux/_flashrt_fp8_ffn_rocm_255584f.abi3.so +3 -0
  31. build/torch212-cxx11-rocm71-x86_64-linux/_ops.py +3 -3
  32. build/torch212-cxx11-rocm71-x86_64-linux/metadata.json +1 -1
  33. build/torch212-cxx11-rocm72-x86_64-linux/__init__.py +112 -0
  34. build/torch212-cxx11-rocm72-x86_64-linux/_flashrt_fp8_ffn_rocm_1b7b2db.abi3.so +0 -3
  35. build/torch212-cxx11-rocm72-x86_64-linux/_flashrt_fp8_ffn_rocm_255584f.abi3.so +3 -0
  36. build/torch212-cxx11-rocm72-x86_64-linux/_ops.py +3 -3
  37. build/torch212-cxx11-rocm72-x86_64-linux/metadata.json +1 -1
benchmarks/benchmark_linear_bias.py ADDED
@@ -0,0 +1,338 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ #!/usr/bin/env python3
2
+ """Benchmark generic FP8 linear+bias projection paths."""
3
+
4
+ from __future__ import annotations
5
+
6
+ import argparse
7
+ import importlib
8
+ import importlib.util
9
+ import json
10
+ import statistics
11
+ import sys
12
+ from pathlib import Path
13
+
14
+ import torch
15
+
16
+
17
+ ROOT = Path(__file__).resolve().parents[2]
18
+ TEST_FILE = ROOT / "flashrt-fp8-ffn" / "tests" / "test_fp8_ffn.py"
19
+
20
+ SHAPES = {
21
+ "decode_m1_d2048_o": (1, 2048, 2048),
22
+ "small_m8_d1536_o": (8, 1536, 1536),
23
+ "groot_dit_m51_qkv": (51, 1536, 4608),
24
+ "groot_dit_m51_o": (51, 1536, 1536),
25
+ "mid_m64_d2048_o": (64, 2048, 2048),
26
+ "groot_backbone_m105_qkv": (105, 2048, 4096),
27
+ "groot_backbone_m105_o": (105, 2048, 2048),
28
+ "mid_m128_siglip_qkv": (128, 1152, 3456),
29
+ "prefill_m256_d1536_o": (256, 1536, 1536),
30
+ "prefill_m512_d2048_o": (512, 2048, 2048),
31
+ }
32
+
33
+
34
+ def load_test_helpers():
35
+ spec = importlib.util.spec_from_file_location("flashrt_fp8_ffn_test_helpers", TEST_FILE)
36
+ if spec is None or spec.loader is None:
37
+ raise RuntimeError(f"cannot load {TEST_FILE}")
38
+ module = importlib.util.module_from_spec(spec)
39
+ spec.loader.exec_module(module)
40
+ return module
41
+
42
+
43
+ def load_ops(backend: str, artifact: str | None):
44
+ helpers = load_test_helpers()
45
+ if backend == "source":
46
+ return helpers.load_source_ops(), helpers
47
+ if artifact:
48
+ sys.path.insert(0, artifact)
49
+ try:
50
+ return importlib.import_module("flashrt_fp8_ffn"), helpers
51
+ finally:
52
+ if artifact:
53
+ sys.path.remove(artifact)
54
+
55
+
56
+ def cuda_time_us(fn, warmup: int, iters: int, rounds: int) -> float:
57
+ samples = []
58
+ for _ in range(rounds):
59
+ for _ in range(warmup):
60
+ fn()
61
+ torch.cuda.synchronize()
62
+ start = torch.cuda.Event(enable_timing=True)
63
+ end = torch.cuda.Event(enable_timing=True)
64
+ start.record()
65
+ for _ in range(iters):
66
+ fn()
67
+ end.record()
68
+ end.synchronize()
69
+ samples.append(start.elapsed_time(end) * 1000.0 / iters)
70
+ return statistics.median(samples)
71
+
72
+
73
+ def graph_runner(fn):
74
+ fn()
75
+ torch.cuda.synchronize()
76
+ graph = torch.cuda.CUDAGraph()
77
+ with torch.cuda.graph(graph):
78
+ fn()
79
+ graph.replay()
80
+ torch.cuda.synchronize()
81
+ return graph.replay
82
+
83
+
84
+ def maybe_fvk_runner(x_fp8, w_fp8, bias, out, x_scale, w_scale, M, N, K):
85
+ try:
86
+ from flash_rt import flash_rt_kernels as fvk
87
+ except ImportError:
88
+ return None, "flash_rt.flash_rt_kernels is unavailable"
89
+ gemm = fvk.GemmRunner()
90
+ alpha = float((x_scale * w_scale).item())
91
+ stream = torch.cuda.current_stream().cuda_stream
92
+
93
+ def run():
94
+ gemm.fp8_nn_bias_bf16(
95
+ x_fp8.data_ptr(), w_fp8.data_ptr(), out.data_ptr(), bias.data_ptr(),
96
+ M, N, K, alpha, stream,
97
+ )
98
+
99
+ try:
100
+ run()
101
+ except RuntimeError as error:
102
+ return None, str(error)
103
+ return run, None
104
+
105
+
106
+ def maybe_fvk_fp16_runners(
107
+ x_fp8, w_fp8, bias_fp16, out_fp16, x_scale, w_scale, M, N, K
108
+ ):
109
+ try:
110
+ from flash_rt import flash_rt_kernels as fvk
111
+ except ImportError:
112
+ return None, None, "flash_rt.flash_rt_kernels is unavailable"
113
+ gemm = fvk.GemmRunner()
114
+ alpha = float((x_scale * w_scale).item())
115
+ stream = torch.cuda.current_stream().cuda_stream
116
+
117
+ def fused():
118
+ gemm.fp8_nn_bias(
119
+ x_fp8.data_ptr(), w_fp8.data_ptr(), out_fp16.data_ptr(),
120
+ bias_fp16.data_ptr(), M, N, K, alpha, stream,
121
+ )
122
+
123
+ def decomposed():
124
+ gemm.fp8_descale_fp16(
125
+ x_fp8.data_ptr(), w_fp8.data_ptr(), out_fp16.data_ptr(), M, N, K,
126
+ x_scale.data_ptr(), w_scale.data_ptr(), stream,
127
+ )
128
+ fvk.add_bias_fp16(
129
+ out_fp16.data_ptr(), bias_fp16.data_ptr(), M, N, stream
130
+ )
131
+
132
+ try:
133
+ fused()
134
+ fused_runner = fused
135
+ fused_error = None
136
+ except RuntimeError as error:
137
+ fused_runner = None
138
+ fused_error = str(error)
139
+ decomposed()
140
+ return fused_runner, decomposed, fused_error
141
+
142
+
143
+ def metrics(got: torch.Tensor, expected: torch.Tensor) -> dict[str, float]:
144
+ got_f = got.float().flatten()
145
+ exp_f = expected.float().flatten()
146
+ diff = (got_f - exp_f).abs()
147
+ return {
148
+ "max_abs": float(diff.max().item()),
149
+ "mean_abs": float(diff.mean().item()),
150
+ "p99_abs": float(torch.quantile(diff, 0.99).item()),
151
+ "cosine": float(torch.nn.functional.cosine_similarity(got_f, exp_f, dim=0).item()),
152
+ }
153
+
154
+
155
+ def run(args) -> dict:
156
+ if not torch.cuda.is_available():
157
+ raise SystemExit("CUDA is required")
158
+ torch.manual_seed(20260718)
159
+ ops, helpers = load_ops(args.backend, args.artifact)
160
+ labels = list(SHAPES) if args.shapes == "all" else args.shapes.split(",")
161
+ results = []
162
+
163
+ for label in labels:
164
+ if label not in SHAPES:
165
+ raise ValueError(f"unknown shape {label!r}")
166
+ M, K, N = SHAPES[label]
167
+ x_bf16 = torch.randn((M, K), device="cuda", dtype=torch.bfloat16) * 0.25
168
+ w_bf16 = torch.randn((N, K), device="cuda", dtype=torch.bfloat16) * (K**-0.5)
169
+ bias = torch.randn((N,), device="cuda", dtype=torch.bfloat16) * 0.01
170
+ x_scale = (
171
+ x_bf16.float().abs().max() / (0.9 * helpers.fp8_max())
172
+ ).clamp_min(1e-6).reshape(1)
173
+ w_scale = (
174
+ w_bf16.float().abs().max() / (0.9 * helpers.fp8_max())
175
+ ).clamp_min(1e-6).reshape(1)
176
+ x_fp8 = helpers.quantize_fp8_reciprocal(x_bf16, x_scale)
177
+ w_fp8 = helpers.quantize_fp8(w_bf16, w_scale)
178
+ out = torch.empty((M, N), device="cuda", dtype=torch.bfloat16)
179
+ region_out = torch.empty_like(out)
180
+ input_fp8 = torch.empty_like(x_fp8)
181
+ fvk_out = torch.empty_like(out)
182
+ fvk_fp16_out = torch.empty((M, N), device="cuda", dtype=torch.float16)
183
+ bias_fp16 = bias.to(torch.float16)
184
+
185
+ def package_fp8():
186
+ ops.fp8_linear_bias_bf16(
187
+ x_fp8, w_fp8, bias, x_scale, w_scale, out=out
188
+ )
189
+
190
+ def package_region():
191
+ ops.bf16_fp8_linear_bias_bf16(
192
+ x_bf16, w_fp8, bias, x_scale, w_scale,
193
+ input_fp8=input_fp8, out=region_out, pad_to=M,
194
+ )
195
+
196
+ reference = helpers.ref_linear_bias(
197
+ x_fp8, w_fp8, bias, x_scale, w_scale
198
+ )
199
+ package_fp8()
200
+ package_metrics = metrics(out, reference)
201
+ if package_metrics["p99_abs"] > 0.015625 or package_metrics["cosine"] < 0.9999:
202
+ raise AssertionError(f"{label} package correctness failed: {package_metrics}")
203
+ package_region()
204
+ if not torch.equal(region_out, out) or not torch.equal(input_fp8, x_fp8):
205
+ raise AssertionError(f"{label} BF16 region does not match FP8 entry")
206
+
207
+ graph = graph_runner(package_region)
208
+ if args.compare_fvk:
209
+ fvk, fvk_error = maybe_fvk_runner(
210
+ x_fp8, w_fp8, bias, fvk_out, x_scale, w_scale, M, N, K
211
+ )
212
+ else:
213
+ fvk, fvk_error = None, "not requested"
214
+ if args.compare_fvk:
215
+ fvk_fp16_fused, fvk_fp16_decomposed, fvk_fp16_error = (
216
+ maybe_fvk_fp16_runners(
217
+ x_fp8, w_fp8, bias_fp16, fvk_fp16_out, x_scale, w_scale,
218
+ M, N, K,
219
+ )
220
+ )
221
+ else:
222
+ fvk_fp16_fused = None
223
+ fvk_fp16_decomposed = None
224
+ fvk_fp16_error = "not requested"
225
+ if fvk is not None:
226
+ fvk()
227
+ fvk_metrics = metrics(fvk_out, reference)
228
+ if fvk_metrics["p99_abs"] > 0.015625 or fvk_metrics["cosine"] < 0.9999:
229
+ raise AssertionError(f"{label} FVK correctness failed: {fvk_metrics}")
230
+ else:
231
+ fvk_metrics = None
232
+
233
+ def eager(value):
234
+ return torch.addmm(bias, value, w_bf16.T)
235
+
236
+ compiled = torch.compile(eager, fullgraph=True) if args.compile_baseline else None
237
+ if compiled is not None:
238
+ compiled_out = compiled(x_bf16)
239
+ changed_out = compiled(x_bf16 + torch.ones_like(x_bf16) * 0.125)
240
+ torch.cuda.synchronize()
241
+ if torch.equal(compiled_out, changed_out):
242
+ raise AssertionError(
243
+ f"{label} compiled baseline did not respond to changed input"
244
+ )
245
+
246
+ package_us = cuda_time_us(package_fp8, args.warmup, args.iters, args.rounds)
247
+ region_us = cuda_time_us(package_region, args.warmup, args.iters, args.rounds)
248
+ graph_us = cuda_time_us(graph, args.warmup, args.iters, args.rounds)
249
+ eager_call = lambda: eager(x_bf16)
250
+ compiled_call = (lambda: compiled(x_bf16)) if compiled is not None else None
251
+ eager_us = cuda_time_us(eager_call, args.warmup, args.iters, args.rounds)
252
+ compiled_us = (
253
+ cuda_time_us(compiled_call, args.warmup, args.iters, args.rounds)
254
+ if compiled_call is not None else None
255
+ )
256
+ fvk_us = (
257
+ cuda_time_us(fvk, args.warmup, args.iters, args.rounds)
258
+ if fvk is not None else None
259
+ )
260
+ fvk_fp16_fused_us = (
261
+ cuda_time_us(
262
+ fvk_fp16_fused, args.warmup, args.iters, args.rounds
263
+ )
264
+ if fvk_fp16_fused is not None else None
265
+ )
266
+ fvk_fp16_decomposed_us = (
267
+ cuda_time_us(
268
+ fvk_fp16_decomposed, args.warmup, args.iters, args.rounds
269
+ )
270
+ if fvk_fp16_decomposed is not None else None
271
+ )
272
+ row = {
273
+ "shape": label,
274
+ "M": M,
275
+ "K": K,
276
+ "N": N,
277
+ "fp8_linear_bias_us": package_us,
278
+ "bf16_region_us": region_us,
279
+ "bf16_region_graph_us": graph_us,
280
+ "torch_bf16_eager_us": eager_us,
281
+ "torch_bf16_compiled_us": compiled_us,
282
+ "fvk_fp8_nn_bias_bf16_us": fvk_us,
283
+ "fvk_status": "ok" if fvk is not None else "unsupported",
284
+ "fvk_error": fvk_error,
285
+ "fvk_fp16_fused_us": fvk_fp16_fused_us,
286
+ "fvk_fp16_decomposed_us": fvk_fp16_decomposed_us,
287
+ "fvk_fp16_fused_error": fvk_fp16_error,
288
+ "package_vs_eager": eager_us / package_us,
289
+ "region_vs_eager": eager_us / region_us,
290
+ "graph_vs_eager": eager_us / graph_us,
291
+ "package_vs_fvk": fvk_us / package_us if fvk_us is not None else None,
292
+ "package_vs_fvk_fp16_fused": (
293
+ fvk_fp16_fused_us / package_us
294
+ if fvk_fp16_fused_us is not None else None
295
+ ),
296
+ "package_vs_fvk_fp16_decomposed": (
297
+ fvk_fp16_decomposed_us / package_us
298
+ if fvk_fp16_decomposed_us is not None else None
299
+ ),
300
+ "package_correctness": package_metrics,
301
+ "fvk_correctness": fvk_metrics,
302
+ }
303
+ results.append(row)
304
+ print(json.dumps(row, sort_keys=True))
305
+
306
+ return {
307
+ "backend": args.backend,
308
+ "device": torch.cuda.get_device_name(0),
309
+ "capability": list(torch.cuda.get_device_capability(0)),
310
+ "torch": torch.__version__,
311
+ "cuda": torch.version.cuda,
312
+ "warmup": args.warmup,
313
+ "iters": args.iters,
314
+ "rounds": args.rounds,
315
+ "results": results,
316
+ }
317
+
318
+
319
+ def main() -> None:
320
+ parser = argparse.ArgumentParser()
321
+ parser.add_argument("--backend", choices=["source", "installed"], default="source")
322
+ parser.add_argument("--artifact", default=None)
323
+ parser.add_argument("--shapes", default="all")
324
+ parser.add_argument("--warmup", type=int, default=20)
325
+ parser.add_argument("--iters", type=int, default=100)
326
+ parser.add_argument("--rounds", type=int, default=5)
327
+ parser.add_argument("--compile-baseline", action="store_true")
328
+ parser.add_argument("--compare-fvk", action="store_true")
329
+ parser.add_argument("--output", type=Path, default=None)
330
+ args = parser.parse_args()
331
+ payload = run(args)
332
+ if args.output is not None:
333
+ args.output.parent.mkdir(parents=True, exist_ok=True)
334
+ args.output.write_text(json.dumps(payload, indent=2) + "\n")
335
+
336
+
337
+ if __name__ == "__main__":
338
+ main()
build/torch211-cxx11-cu128-x86_64-linux/__init__.py CHANGED
@@ -55,6 +55,50 @@ def _fp8_gemm_bf16_fake(
55
  return None
56
 
57
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
58
  @torch.library.register_fake(add_op_namespace_prefix("fp8_linear_bias_gelu_quant_bf16"))
59
  def _fp8_linear_bias_gelu_quant_bf16_fake(
60
  input: torch.Tensor,
@@ -157,6 +201,33 @@ def fp8_gemm_bf16(
157
  return out
158
 
159
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
160
  def fp8_linear_bias_gelu_quant_bf16(
161
  input: torch.Tensor,
162
  weight: torch.Tensor,
@@ -260,6 +331,45 @@ def _midm_padded_rows(input: torch.Tensor) -> int:
260
  return rows
261
 
262
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
263
  def bf16_fp8_gelu_mlp_bf16(
264
  input: torch.Tensor,
265
  up_weight: torch.Tensor,
@@ -324,8 +434,10 @@ def bf16_fp8_gelu_mlp_bf16(
324
 
325
 
326
  __all__ = [
 
327
  "bf16_fp8_gelu_mlp_bf16",
328
  "fp8_gemm_bf16",
329
  "fp8_gelu_mlp_bf16",
 
330
  "fp8_linear_bias_gelu_quant_bf16",
331
  ]
 
55
  return None
56
 
57
 
58
+ @torch.library.register_fake(add_op_namespace_prefix("fp8_linear_bias_bf16"))
59
+ def _fp8_linear_bias_bf16_fake(
60
+ input: torch.Tensor,
61
+ weight: torch.Tensor,
62
+ bias: torch.Tensor,
63
+ input_scale: torch.Tensor,
64
+ weight_scale: torch.Tensor,
65
+ out: torch.Tensor,
66
+ ) -> None:
67
+ if input.dim() != 2 or weight.dim() != 2:
68
+ raise RuntimeError("input and weight must be rank-2 tensors")
69
+ if bias.shape != (weight.shape[0],):
70
+ raise RuntimeError("bias shape must be (weight.shape[0],)")
71
+ if out.shape != (input.shape[0], weight.shape[0]):
72
+ raise RuntimeError("out shape must be (input.shape[0], weight.shape[0])")
73
+ return None
74
+
75
+
76
+ @torch.library.register_fake(add_op_namespace_prefix("bf16_fp8_linear_bias_bf16"))
77
+ def _bf16_fp8_linear_bias_bf16_fake(
78
+ input: torch.Tensor,
79
+ weight: torch.Tensor,
80
+ bias: torch.Tensor,
81
+ input_scale: torch.Tensor,
82
+ weight_scale: torch.Tensor,
83
+ input_fp8: torch.Tensor,
84
+ out: torch.Tensor,
85
+ ) -> None:
86
+ if input.dim() != 2 or weight.dim() != 2:
87
+ raise RuntimeError("input and weight must be rank-2 tensors")
88
+ if input.shape[1] != weight.shape[1]:
89
+ raise RuntimeError("input.shape[1] must match weight.shape[1]")
90
+ padded_m = input_fp8.shape[0]
91
+ if padded_m < input.shape[0]:
92
+ raise RuntimeError("input_fp8 padded rows must cover input rows")
93
+ if input_fp8.shape != (padded_m, input.shape[1]):
94
+ raise RuntimeError("input_fp8 must have shape (padded_m, input.shape[1])")
95
+ if bias.shape != (weight.shape[0],):
96
+ raise RuntimeError("bias shape must be (weight.shape[0],)")
97
+ if out.shape != (padded_m, weight.shape[0]):
98
+ raise RuntimeError("out must have shape (padded_m, weight.shape[0])")
99
+ return None
100
+
101
+
102
  @torch.library.register_fake(add_op_namespace_prefix("fp8_linear_bias_gelu_quant_bf16"))
103
  def _fp8_linear_bias_gelu_quant_bf16_fake(
104
  input: torch.Tensor,
 
201
  return out
202
 
203
 
204
+ def fp8_linear_bias_bf16(
205
+ input: torch.Tensor,
206
+ weight: torch.Tensor,
207
+ bias: torch.Tensor,
208
+ input_scale: torch.Tensor,
209
+ weight_scale: torch.Tensor,
210
+ out: torch.Tensor | None = None,
211
+ ) -> torch.Tensor:
212
+ """Run an FP8-weight linear projection with BF16 bias and output.
213
+
214
+ ``input`` and ``weight`` use FP8 E4M3 with shapes ``(M, K)`` and
215
+ ``(N, K)``. Scales are device float32 scalar tensors. Pass ``out`` to keep
216
+ the call allocation-free for CUDA Graph capture.
217
+ """
218
+
219
+ if out is None:
220
+ out = torch.empty(
221
+ (input.shape[0], weight.shape[0]),
222
+ device=input.device,
223
+ dtype=torch.bfloat16,
224
+ )
225
+ ops.fp8_linear_bias_bf16(
226
+ input, weight, bias, input_scale, weight_scale, out
227
+ )
228
+ return out
229
+
230
+
231
  def fp8_linear_bias_gelu_quant_bf16(
232
  input: torch.Tensor,
233
  weight: torch.Tensor,
 
331
  return rows
332
 
333
 
334
+ def bf16_fp8_linear_bias_bf16(
335
+ input: torch.Tensor,
336
+ weight: torch.Tensor,
337
+ bias: torch.Tensor,
338
+ input_scale: torch.Tensor,
339
+ weight_scale: torch.Tensor,
340
+ input_fp8: torch.Tensor | None = None,
341
+ out: torch.Tensor | None = None,
342
+ *,
343
+ pad_to: int | None = None,
344
+ ) -> torch.Tensor:
345
+ """Run a static-scale FP8 linear projection from a BF16 boundary.
346
+
347
+ This traceable region entry quantizes ``input`` and computes the FP8
348
+ projection with BF16 bias/output. Thor SM110 pads M=9..128 to a multiple of
349
+ 64 by default. Preallocate ``input_fp8`` and ``out`` for allocation-free
350
+ CUDA Graph replay.
351
+ """
352
+
353
+ logical_m = input.shape[0]
354
+ padded_m = _midm_padded_rows(input) if pad_to is None else pad_to
355
+ if padded_m < logical_m:
356
+ raise ValueError("pad_to must be >= input.shape[0]")
357
+ if input_fp8 is None:
358
+ input_fp8 = torch.empty(
359
+ (padded_m, input.shape[1]), device=input.device, dtype=_fp8_dtype()
360
+ )
361
+ if out is None:
362
+ out = torch.empty(
363
+ (padded_m, weight.shape[0]),
364
+ device=input.device,
365
+ dtype=torch.bfloat16,
366
+ )
367
+ ops.bf16_fp8_linear_bias_bf16(
368
+ input, weight, bias, input_scale, weight_scale, input_fp8, out
369
+ )
370
+ return out[:logical_m]
371
+
372
+
373
  def bf16_fp8_gelu_mlp_bf16(
374
  input: torch.Tensor,
375
  up_weight: torch.Tensor,
 
434
 
435
 
436
  __all__ = [
437
+ "bf16_fp8_linear_bias_bf16",
438
  "bf16_fp8_gelu_mlp_bf16",
439
  "fp8_gemm_bf16",
440
  "fp8_gelu_mlp_bf16",
441
+ "fp8_linear_bias_bf16",
442
  "fp8_linear_bias_gelu_quant_bf16",
443
  ]
build/torch211-cxx11-cu128-x86_64-linux/{_flashrt_fp8_ffn_cuda_1b7b2db.abi3.so → _flashrt_fp8_ffn_cuda_255584f.abi3.so} RENAMED
@@ -1,3 +1,3 @@
1
  version https://git-lfs.github.com/spec/v1
2
- oid sha256:a4c6a2327a4e49297b155351f1b38affde2c4dc74374258b7fe0caa11d051113
3
- size 677320
 
1
  version https://git-lfs.github.com/spec/v1
2
+ oid sha256:3d274681fba749480e852c3da2670c29041914b6edfb234ebce6e46bec1afa8c
3
+ size 698640
build/torch211-cxx11-cu128-x86_64-linux/_ops.py CHANGED
@@ -1,9 +1,9 @@
1
  import torch
2
- from . import _flashrt_fp8_ffn_cuda_1b7b2db
3
- ops = torch.ops._flashrt_fp8_ffn_cuda_1b7b2db
4
 
5
  def add_op_namespace_prefix(op_name: str):
6
  """
7
  Prefix op by namespace.
8
  """
9
- return f"_flashrt_fp8_ffn_cuda_1b7b2db::{op_name}"
 
1
  import torch
2
+ from . import _flashrt_fp8_ffn_cuda_255584f
3
+ ops = torch.ops._flashrt_fp8_ffn_cuda_255584f
4
 
5
  def add_op_namespace_prefix(op_name: str):
6
  """
7
  Prefix op by namespace.
8
  """
9
+ return f"_flashrt_fp8_ffn_cuda_255584f::{op_name}"
build/torch211-cxx11-cu128-x86_64-linux/metadata.json CHANGED
@@ -1,6 +1,6 @@
1
  {
2
  "name": "flashrt-fp8-ffn",
3
- "id": "_flashrt_fp8_ffn_cuda_1b7b2db",
4
  "version": 1,
5
  "license": "Apache-2.0",
6
  "python-depends": [],
 
1
  {
2
  "name": "flashrt-fp8-ffn",
3
+ "id": "_flashrt_fp8_ffn_cuda_255584f",
4
  "version": 1,
5
  "license": "Apache-2.0",
6
  "python-depends": [],
build/torch211-cxx11-cu130-x86_64-linux/__init__.py CHANGED
@@ -55,6 +55,50 @@ def _fp8_gemm_bf16_fake(
55
  return None
56
 
57
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
58
  @torch.library.register_fake(add_op_namespace_prefix("fp8_linear_bias_gelu_quant_bf16"))
59
  def _fp8_linear_bias_gelu_quant_bf16_fake(
60
  input: torch.Tensor,
@@ -157,6 +201,33 @@ def fp8_gemm_bf16(
157
  return out
158
 
159
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
160
  def fp8_linear_bias_gelu_quant_bf16(
161
  input: torch.Tensor,
162
  weight: torch.Tensor,
@@ -260,6 +331,45 @@ def _midm_padded_rows(input: torch.Tensor) -> int:
260
  return rows
261
 
262
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
263
  def bf16_fp8_gelu_mlp_bf16(
264
  input: torch.Tensor,
265
  up_weight: torch.Tensor,
@@ -324,8 +434,10 @@ def bf16_fp8_gelu_mlp_bf16(
324
 
325
 
326
  __all__ = [
 
327
  "bf16_fp8_gelu_mlp_bf16",
328
  "fp8_gemm_bf16",
329
  "fp8_gelu_mlp_bf16",
 
330
  "fp8_linear_bias_gelu_quant_bf16",
331
  ]
 
55
  return None
56
 
57
 
58
+ @torch.library.register_fake(add_op_namespace_prefix("fp8_linear_bias_bf16"))
59
+ def _fp8_linear_bias_bf16_fake(
60
+ input: torch.Tensor,
61
+ weight: torch.Tensor,
62
+ bias: torch.Tensor,
63
+ input_scale: torch.Tensor,
64
+ weight_scale: torch.Tensor,
65
+ out: torch.Tensor,
66
+ ) -> None:
67
+ if input.dim() != 2 or weight.dim() != 2:
68
+ raise RuntimeError("input and weight must be rank-2 tensors")
69
+ if bias.shape != (weight.shape[0],):
70
+ raise RuntimeError("bias shape must be (weight.shape[0],)")
71
+ if out.shape != (input.shape[0], weight.shape[0]):
72
+ raise RuntimeError("out shape must be (input.shape[0], weight.shape[0])")
73
+ return None
74
+
75
+
76
+ @torch.library.register_fake(add_op_namespace_prefix("bf16_fp8_linear_bias_bf16"))
77
+ def _bf16_fp8_linear_bias_bf16_fake(
78
+ input: torch.Tensor,
79
+ weight: torch.Tensor,
80
+ bias: torch.Tensor,
81
+ input_scale: torch.Tensor,
82
+ weight_scale: torch.Tensor,
83
+ input_fp8: torch.Tensor,
84
+ out: torch.Tensor,
85
+ ) -> None:
86
+ if input.dim() != 2 or weight.dim() != 2:
87
+ raise RuntimeError("input and weight must be rank-2 tensors")
88
+ if input.shape[1] != weight.shape[1]:
89
+ raise RuntimeError("input.shape[1] must match weight.shape[1]")
90
+ padded_m = input_fp8.shape[0]
91
+ if padded_m < input.shape[0]:
92
+ raise RuntimeError("input_fp8 padded rows must cover input rows")
93
+ if input_fp8.shape != (padded_m, input.shape[1]):
94
+ raise RuntimeError("input_fp8 must have shape (padded_m, input.shape[1])")
95
+ if bias.shape != (weight.shape[0],):
96
+ raise RuntimeError("bias shape must be (weight.shape[0],)")
97
+ if out.shape != (padded_m, weight.shape[0]):
98
+ raise RuntimeError("out must have shape (padded_m, weight.shape[0])")
99
+ return None
100
+
101
+
102
  @torch.library.register_fake(add_op_namespace_prefix("fp8_linear_bias_gelu_quant_bf16"))
103
  def _fp8_linear_bias_gelu_quant_bf16_fake(
104
  input: torch.Tensor,
 
201
  return out
202
 
203
 
204
+ def fp8_linear_bias_bf16(
205
+ input: torch.Tensor,
206
+ weight: torch.Tensor,
207
+ bias: torch.Tensor,
208
+ input_scale: torch.Tensor,
209
+ weight_scale: torch.Tensor,
210
+ out: torch.Tensor | None = None,
211
+ ) -> torch.Tensor:
212
+ """Run an FP8-weight linear projection with BF16 bias and output.
213
+
214
+ ``input`` and ``weight`` use FP8 E4M3 with shapes ``(M, K)`` and
215
+ ``(N, K)``. Scales are device float32 scalar tensors. Pass ``out`` to keep
216
+ the call allocation-free for CUDA Graph capture.
217
+ """
218
+
219
+ if out is None:
220
+ out = torch.empty(
221
+ (input.shape[0], weight.shape[0]),
222
+ device=input.device,
223
+ dtype=torch.bfloat16,
224
+ )
225
+ ops.fp8_linear_bias_bf16(
226
+ input, weight, bias, input_scale, weight_scale, out
227
+ )
228
+ return out
229
+
230
+
231
  def fp8_linear_bias_gelu_quant_bf16(
232
  input: torch.Tensor,
233
  weight: torch.Tensor,
 
331
  return rows
332
 
333
 
334
+ def bf16_fp8_linear_bias_bf16(
335
+ input: torch.Tensor,
336
+ weight: torch.Tensor,
337
+ bias: torch.Tensor,
338
+ input_scale: torch.Tensor,
339
+ weight_scale: torch.Tensor,
340
+ input_fp8: torch.Tensor | None = None,
341
+ out: torch.Tensor | None = None,
342
+ *,
343
+ pad_to: int | None = None,
344
+ ) -> torch.Tensor:
345
+ """Run a static-scale FP8 linear projection from a BF16 boundary.
346
+
347
+ This traceable region entry quantizes ``input`` and computes the FP8
348
+ projection with BF16 bias/output. Thor SM110 pads M=9..128 to a multiple of
349
+ 64 by default. Preallocate ``input_fp8`` and ``out`` for allocation-free
350
+ CUDA Graph replay.
351
+ """
352
+
353
+ logical_m = input.shape[0]
354
+ padded_m = _midm_padded_rows(input) if pad_to is None else pad_to
355
+ if padded_m < logical_m:
356
+ raise ValueError("pad_to must be >= input.shape[0]")
357
+ if input_fp8 is None:
358
+ input_fp8 = torch.empty(
359
+ (padded_m, input.shape[1]), device=input.device, dtype=_fp8_dtype()
360
+ )
361
+ if out is None:
362
+ out = torch.empty(
363
+ (padded_m, weight.shape[0]),
364
+ device=input.device,
365
+ dtype=torch.bfloat16,
366
+ )
367
+ ops.bf16_fp8_linear_bias_bf16(
368
+ input, weight, bias, input_scale, weight_scale, input_fp8, out
369
+ )
370
+ return out[:logical_m]
371
+
372
+
373
  def bf16_fp8_gelu_mlp_bf16(
374
  input: torch.Tensor,
375
  up_weight: torch.Tensor,
 
434
 
435
 
436
  __all__ = [
437
+ "bf16_fp8_linear_bias_bf16",
438
  "bf16_fp8_gelu_mlp_bf16",
439
  "fp8_gemm_bf16",
440
  "fp8_gelu_mlp_bf16",
441
+ "fp8_linear_bias_bf16",
442
  "fp8_linear_bias_gelu_quant_bf16",
443
  ]
build/torch211-cxx11-cu130-x86_64-linux/{_flashrt_fp8_ffn_cuda_1b7b2db.abi3.so → _flashrt_fp8_ffn_cuda_255584f.abi3.so} RENAMED
@@ -1,3 +1,3 @@
1
  version https://git-lfs.github.com/spec/v1
2
- oid sha256:dc41d166984f3b05d160024886e352f9757db7ade1cb46868eb846e5753f94dc
3
- size 647000
 
1
  version https://git-lfs.github.com/spec/v1
2
+ oid sha256:2636112b16bd21bec7d249cf99d86206b873df2f8672fe47a560e57171b55cd2
3
+ size 668320
build/torch211-cxx11-cu130-x86_64-linux/_ops.py CHANGED
@@ -1,9 +1,9 @@
1
  import torch
2
- from . import _flashrt_fp8_ffn_cuda_1b7b2db
3
- ops = torch.ops._flashrt_fp8_ffn_cuda_1b7b2db
4
 
5
  def add_op_namespace_prefix(op_name: str):
6
  """
7
  Prefix op by namespace.
8
  """
9
- return f"_flashrt_fp8_ffn_cuda_1b7b2db::{op_name}"
 
1
  import torch
2
+ from . import _flashrt_fp8_ffn_cuda_255584f
3
+ ops = torch.ops._flashrt_fp8_ffn_cuda_255584f
4
 
5
  def add_op_namespace_prefix(op_name: str):
6
  """
7
  Prefix op by namespace.
8
  """
9
+ return f"_flashrt_fp8_ffn_cuda_255584f::{op_name}"
build/torch211-cxx11-cu130-x86_64-linux/metadata.json CHANGED
@@ -1,6 +1,6 @@
1
  {
2
  "name": "flashrt-fp8-ffn",
3
- "id": "_flashrt_fp8_ffn_cuda_1b7b2db",
4
  "version": 1,
5
  "license": "Apache-2.0",
6
  "python-depends": [],
 
1
  {
2
  "name": "flashrt-fp8-ffn",
3
+ "id": "_flashrt_fp8_ffn_cuda_255584f",
4
  "version": 1,
5
  "license": "Apache-2.0",
6
  "python-depends": [],
build/torch211-cxx11-rocm71-x86_64-linux/__init__.py CHANGED
@@ -55,6 +55,50 @@ def _fp8_gemm_bf16_fake(
55
  return None
56
 
57
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
58
  @torch.library.register_fake(add_op_namespace_prefix("fp8_linear_bias_gelu_quant_bf16"))
59
  def _fp8_linear_bias_gelu_quant_bf16_fake(
60
  input: torch.Tensor,
@@ -157,6 +201,33 @@ def fp8_gemm_bf16(
157
  return out
158
 
159
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
160
  def fp8_linear_bias_gelu_quant_bf16(
161
  input: torch.Tensor,
162
  weight: torch.Tensor,
@@ -260,6 +331,45 @@ def _midm_padded_rows(input: torch.Tensor) -> int:
260
  return rows
261
 
262
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
263
  def bf16_fp8_gelu_mlp_bf16(
264
  input: torch.Tensor,
265
  up_weight: torch.Tensor,
@@ -324,8 +434,10 @@ def bf16_fp8_gelu_mlp_bf16(
324
 
325
 
326
  __all__ = [
 
327
  "bf16_fp8_gelu_mlp_bf16",
328
  "fp8_gemm_bf16",
329
  "fp8_gelu_mlp_bf16",
 
330
  "fp8_linear_bias_gelu_quant_bf16",
331
  ]
 
55
  return None
56
 
57
 
58
+ @torch.library.register_fake(add_op_namespace_prefix("fp8_linear_bias_bf16"))
59
+ def _fp8_linear_bias_bf16_fake(
60
+ input: torch.Tensor,
61
+ weight: torch.Tensor,
62
+ bias: torch.Tensor,
63
+ input_scale: torch.Tensor,
64
+ weight_scale: torch.Tensor,
65
+ out: torch.Tensor,
66
+ ) -> None:
67
+ if input.dim() != 2 or weight.dim() != 2:
68
+ raise RuntimeError("input and weight must be rank-2 tensors")
69
+ if bias.shape != (weight.shape[0],):
70
+ raise RuntimeError("bias shape must be (weight.shape[0],)")
71
+ if out.shape != (input.shape[0], weight.shape[0]):
72
+ raise RuntimeError("out shape must be (input.shape[0], weight.shape[0])")
73
+ return None
74
+
75
+
76
+ @torch.library.register_fake(add_op_namespace_prefix("bf16_fp8_linear_bias_bf16"))
77
+ def _bf16_fp8_linear_bias_bf16_fake(
78
+ input: torch.Tensor,
79
+ weight: torch.Tensor,
80
+ bias: torch.Tensor,
81
+ input_scale: torch.Tensor,
82
+ weight_scale: torch.Tensor,
83
+ input_fp8: torch.Tensor,
84
+ out: torch.Tensor,
85
+ ) -> None:
86
+ if input.dim() != 2 or weight.dim() != 2:
87
+ raise RuntimeError("input and weight must be rank-2 tensors")
88
+ if input.shape[1] != weight.shape[1]:
89
+ raise RuntimeError("input.shape[1] must match weight.shape[1]")
90
+ padded_m = input_fp8.shape[0]
91
+ if padded_m < input.shape[0]:
92
+ raise RuntimeError("input_fp8 padded rows must cover input rows")
93
+ if input_fp8.shape != (padded_m, input.shape[1]):
94
+ raise RuntimeError("input_fp8 must have shape (padded_m, input.shape[1])")
95
+ if bias.shape != (weight.shape[0],):
96
+ raise RuntimeError("bias shape must be (weight.shape[0],)")
97
+ if out.shape != (padded_m, weight.shape[0]):
98
+ raise RuntimeError("out must have shape (padded_m, weight.shape[0])")
99
+ return None
100
+
101
+
102
  @torch.library.register_fake(add_op_namespace_prefix("fp8_linear_bias_gelu_quant_bf16"))
103
  def _fp8_linear_bias_gelu_quant_bf16_fake(
104
  input: torch.Tensor,
 
201
  return out
202
 
203
 
204
+ def fp8_linear_bias_bf16(
205
+ input: torch.Tensor,
206
+ weight: torch.Tensor,
207
+ bias: torch.Tensor,
208
+ input_scale: torch.Tensor,
209
+ weight_scale: torch.Tensor,
210
+ out: torch.Tensor | None = None,
211
+ ) -> torch.Tensor:
212
+ """Run an FP8-weight linear projection with BF16 bias and output.
213
+
214
+ ``input`` and ``weight`` use FP8 E4M3 with shapes ``(M, K)`` and
215
+ ``(N, K)``. Scales are device float32 scalar tensors. Pass ``out`` to keep
216
+ the call allocation-free for CUDA Graph capture.
217
+ """
218
+
219
+ if out is None:
220
+ out = torch.empty(
221
+ (input.shape[0], weight.shape[0]),
222
+ device=input.device,
223
+ dtype=torch.bfloat16,
224
+ )
225
+ ops.fp8_linear_bias_bf16(
226
+ input, weight, bias, input_scale, weight_scale, out
227
+ )
228
+ return out
229
+
230
+
231
  def fp8_linear_bias_gelu_quant_bf16(
232
  input: torch.Tensor,
233
  weight: torch.Tensor,
 
331
  return rows
332
 
333
 
334
+ def bf16_fp8_linear_bias_bf16(
335
+ input: torch.Tensor,
336
+ weight: torch.Tensor,
337
+ bias: torch.Tensor,
338
+ input_scale: torch.Tensor,
339
+ weight_scale: torch.Tensor,
340
+ input_fp8: torch.Tensor | None = None,
341
+ out: torch.Tensor | None = None,
342
+ *,
343
+ pad_to: int | None = None,
344
+ ) -> torch.Tensor:
345
+ """Run a static-scale FP8 linear projection from a BF16 boundary.
346
+
347
+ This traceable region entry quantizes ``input`` and computes the FP8
348
+ projection with BF16 bias/output. Thor SM110 pads M=9..128 to a multiple of
349
+ 64 by default. Preallocate ``input_fp8`` and ``out`` for allocation-free
350
+ CUDA Graph replay.
351
+ """
352
+
353
+ logical_m = input.shape[0]
354
+ padded_m = _midm_padded_rows(input) if pad_to is None else pad_to
355
+ if padded_m < logical_m:
356
+ raise ValueError("pad_to must be >= input.shape[0]")
357
+ if input_fp8 is None:
358
+ input_fp8 = torch.empty(
359
+ (padded_m, input.shape[1]), device=input.device, dtype=_fp8_dtype()
360
+ )
361
+ if out is None:
362
+ out = torch.empty(
363
+ (padded_m, weight.shape[0]),
364
+ device=input.device,
365
+ dtype=torch.bfloat16,
366
+ )
367
+ ops.bf16_fp8_linear_bias_bf16(
368
+ input, weight, bias, input_scale, weight_scale, input_fp8, out
369
+ )
370
+ return out[:logical_m]
371
+
372
+
373
  def bf16_fp8_gelu_mlp_bf16(
374
  input: torch.Tensor,
375
  up_weight: torch.Tensor,
 
434
 
435
 
436
  __all__ = [
437
+ "bf16_fp8_linear_bias_bf16",
438
  "bf16_fp8_gelu_mlp_bf16",
439
  "fp8_gemm_bf16",
440
  "fp8_gelu_mlp_bf16",
441
+ "fp8_linear_bias_bf16",
442
  "fp8_linear_bias_gelu_quant_bf16",
443
  ]
build/torch211-cxx11-rocm71-x86_64-linux/{_flashrt_fp8_ffn_rocm_1b7b2db.abi3.so → _flashrt_fp8_ffn_rocm_255584f.abi3.so} RENAMED
@@ -1,3 +1,3 @@
1
  version https://git-lfs.github.com/spec/v1
2
- oid sha256:7e9b5e1e2b4d7de01d7da70219952c7587879ddd254f15f9f60060c2e2f9838c
3
- size 167328
 
1
  version https://git-lfs.github.com/spec/v1
2
+ oid sha256:b0a6f1d91521ad7db13bb2f702ce4e74c4f54aa5e3666c6a11c52bd4ecc1c31d
3
+ size 180528
build/torch211-cxx11-rocm71-x86_64-linux/_ops.py CHANGED
@@ -1,9 +1,9 @@
1
  import torch
2
- from . import _flashrt_fp8_ffn_rocm_1b7b2db
3
- ops = torch.ops._flashrt_fp8_ffn_rocm_1b7b2db
4
 
5
  def add_op_namespace_prefix(op_name: str):
6
  """
7
  Prefix op by namespace.
8
  """
9
- return f"_flashrt_fp8_ffn_rocm_1b7b2db::{op_name}"
 
1
  import torch
2
+ from . import _flashrt_fp8_ffn_rocm_255584f
3
+ ops = torch.ops._flashrt_fp8_ffn_rocm_255584f
4
 
5
  def add_op_namespace_prefix(op_name: str):
6
  """
7
  Prefix op by namespace.
8
  """
9
+ return f"_flashrt_fp8_ffn_rocm_255584f::{op_name}"
build/torch211-cxx11-rocm71-x86_64-linux/metadata.json CHANGED
@@ -1,6 +1,6 @@
1
  {
2
  "name": "flashrt-fp8-ffn",
3
- "id": "_flashrt_fp8_ffn_rocm_1b7b2db",
4
  "version": 1,
5
  "license": "Apache-2.0",
6
  "python-depends": [],
 
1
  {
2
  "name": "flashrt-fp8-ffn",
3
+ "id": "_flashrt_fp8_ffn_rocm_255584f",
4
  "version": 1,
5
  "license": "Apache-2.0",
6
  "python-depends": [],
build/torch211-cxx11-rocm72-x86_64-linux/__init__.py CHANGED
@@ -55,6 +55,50 @@ def _fp8_gemm_bf16_fake(
55
  return None
56
 
57
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
58
  @torch.library.register_fake(add_op_namespace_prefix("fp8_linear_bias_gelu_quant_bf16"))
59
  def _fp8_linear_bias_gelu_quant_bf16_fake(
60
  input: torch.Tensor,
@@ -157,6 +201,33 @@ def fp8_gemm_bf16(
157
  return out
158
 
159
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
160
  def fp8_linear_bias_gelu_quant_bf16(
161
  input: torch.Tensor,
162
  weight: torch.Tensor,
@@ -260,6 +331,45 @@ def _midm_padded_rows(input: torch.Tensor) -> int:
260
  return rows
261
 
262
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
263
  def bf16_fp8_gelu_mlp_bf16(
264
  input: torch.Tensor,
265
  up_weight: torch.Tensor,
@@ -324,8 +434,10 @@ def bf16_fp8_gelu_mlp_bf16(
324
 
325
 
326
  __all__ = [
 
327
  "bf16_fp8_gelu_mlp_bf16",
328
  "fp8_gemm_bf16",
329
  "fp8_gelu_mlp_bf16",
 
330
  "fp8_linear_bias_gelu_quant_bf16",
331
  ]
 
55
  return None
56
 
57
 
58
+ @torch.library.register_fake(add_op_namespace_prefix("fp8_linear_bias_bf16"))
59
+ def _fp8_linear_bias_bf16_fake(
60
+ input: torch.Tensor,
61
+ weight: torch.Tensor,
62
+ bias: torch.Tensor,
63
+ input_scale: torch.Tensor,
64
+ weight_scale: torch.Tensor,
65
+ out: torch.Tensor,
66
+ ) -> None:
67
+ if input.dim() != 2 or weight.dim() != 2:
68
+ raise RuntimeError("input and weight must be rank-2 tensors")
69
+ if bias.shape != (weight.shape[0],):
70
+ raise RuntimeError("bias shape must be (weight.shape[0],)")
71
+ if out.shape != (input.shape[0], weight.shape[0]):
72
+ raise RuntimeError("out shape must be (input.shape[0], weight.shape[0])")
73
+ return None
74
+
75
+
76
+ @torch.library.register_fake(add_op_namespace_prefix("bf16_fp8_linear_bias_bf16"))
77
+ def _bf16_fp8_linear_bias_bf16_fake(
78
+ input: torch.Tensor,
79
+ weight: torch.Tensor,
80
+ bias: torch.Tensor,
81
+ input_scale: torch.Tensor,
82
+ weight_scale: torch.Tensor,
83
+ input_fp8: torch.Tensor,
84
+ out: torch.Tensor,
85
+ ) -> None:
86
+ if input.dim() != 2 or weight.dim() != 2:
87
+ raise RuntimeError("input and weight must be rank-2 tensors")
88
+ if input.shape[1] != weight.shape[1]:
89
+ raise RuntimeError("input.shape[1] must match weight.shape[1]")
90
+ padded_m = input_fp8.shape[0]
91
+ if padded_m < input.shape[0]:
92
+ raise RuntimeError("input_fp8 padded rows must cover input rows")
93
+ if input_fp8.shape != (padded_m, input.shape[1]):
94
+ raise RuntimeError("input_fp8 must have shape (padded_m, input.shape[1])")
95
+ if bias.shape != (weight.shape[0],):
96
+ raise RuntimeError("bias shape must be (weight.shape[0],)")
97
+ if out.shape != (padded_m, weight.shape[0]):
98
+ raise RuntimeError("out must have shape (padded_m, weight.shape[0])")
99
+ return None
100
+
101
+
102
  @torch.library.register_fake(add_op_namespace_prefix("fp8_linear_bias_gelu_quant_bf16"))
103
  def _fp8_linear_bias_gelu_quant_bf16_fake(
104
  input: torch.Tensor,
 
201
  return out
202
 
203
 
204
+ def fp8_linear_bias_bf16(
205
+ input: torch.Tensor,
206
+ weight: torch.Tensor,
207
+ bias: torch.Tensor,
208
+ input_scale: torch.Tensor,
209
+ weight_scale: torch.Tensor,
210
+ out: torch.Tensor | None = None,
211
+ ) -> torch.Tensor:
212
+ """Run an FP8-weight linear projection with BF16 bias and output.
213
+
214
+ ``input`` and ``weight`` use FP8 E4M3 with shapes ``(M, K)`` and
215
+ ``(N, K)``. Scales are device float32 scalar tensors. Pass ``out`` to keep
216
+ the call allocation-free for CUDA Graph capture.
217
+ """
218
+
219
+ if out is None:
220
+ out = torch.empty(
221
+ (input.shape[0], weight.shape[0]),
222
+ device=input.device,
223
+ dtype=torch.bfloat16,
224
+ )
225
+ ops.fp8_linear_bias_bf16(
226
+ input, weight, bias, input_scale, weight_scale, out
227
+ )
228
+ return out
229
+
230
+
231
  def fp8_linear_bias_gelu_quant_bf16(
232
  input: torch.Tensor,
233
  weight: torch.Tensor,
 
331
  return rows
332
 
333
 
334
+ def bf16_fp8_linear_bias_bf16(
335
+ input: torch.Tensor,
336
+ weight: torch.Tensor,
337
+ bias: torch.Tensor,
338
+ input_scale: torch.Tensor,
339
+ weight_scale: torch.Tensor,
340
+ input_fp8: torch.Tensor | None = None,
341
+ out: torch.Tensor | None = None,
342
+ *,
343
+ pad_to: int | None = None,
344
+ ) -> torch.Tensor:
345
+ """Run a static-scale FP8 linear projection from a BF16 boundary.
346
+
347
+ This traceable region entry quantizes ``input`` and computes the FP8
348
+ projection with BF16 bias/output. Thor SM110 pads M=9..128 to a multiple of
349
+ 64 by default. Preallocate ``input_fp8`` and ``out`` for allocation-free
350
+ CUDA Graph replay.
351
+ """
352
+
353
+ logical_m = input.shape[0]
354
+ padded_m = _midm_padded_rows(input) if pad_to is None else pad_to
355
+ if padded_m < logical_m:
356
+ raise ValueError("pad_to must be >= input.shape[0]")
357
+ if input_fp8 is None:
358
+ input_fp8 = torch.empty(
359
+ (padded_m, input.shape[1]), device=input.device, dtype=_fp8_dtype()
360
+ )
361
+ if out is None:
362
+ out = torch.empty(
363
+ (padded_m, weight.shape[0]),
364
+ device=input.device,
365
+ dtype=torch.bfloat16,
366
+ )
367
+ ops.bf16_fp8_linear_bias_bf16(
368
+ input, weight, bias, input_scale, weight_scale, input_fp8, out
369
+ )
370
+ return out[:logical_m]
371
+
372
+
373
  def bf16_fp8_gelu_mlp_bf16(
374
  input: torch.Tensor,
375
  up_weight: torch.Tensor,
 
434
 
435
 
436
  __all__ = [
437
+ "bf16_fp8_linear_bias_bf16",
438
  "bf16_fp8_gelu_mlp_bf16",
439
  "fp8_gemm_bf16",
440
  "fp8_gelu_mlp_bf16",
441
+ "fp8_linear_bias_bf16",
442
  "fp8_linear_bias_gelu_quant_bf16",
443
  ]
build/torch211-cxx11-rocm72-x86_64-linux/{_flashrt_fp8_ffn_rocm_1b7b2db.abi3.so → _flashrt_fp8_ffn_rocm_255584f.abi3.so} RENAMED
@@ -1,3 +1,3 @@
1
  version https://git-lfs.github.com/spec/v1
2
- oid sha256:fa70aea2a57fa5f25b8a5cc32c8fe2da40e028f61495cfe7a25ac009d27ef41b
3
- size 165760
 
1
  version https://git-lfs.github.com/spec/v1
2
+ oid sha256:01f36636ddf259f85c94157b09cb5267b9cd4b371b148acd5150f4f3c13f3b78
3
+ size 178992
build/torch211-cxx11-rocm72-x86_64-linux/_ops.py CHANGED
@@ -1,9 +1,9 @@
1
  import torch
2
- from . import _flashrt_fp8_ffn_rocm_1b7b2db
3
- ops = torch.ops._flashrt_fp8_ffn_rocm_1b7b2db
4
 
5
  def add_op_namespace_prefix(op_name: str):
6
  """
7
  Prefix op by namespace.
8
  """
9
- return f"_flashrt_fp8_ffn_rocm_1b7b2db::{op_name}"
 
1
  import torch
2
+ from . import _flashrt_fp8_ffn_rocm_255584f
3
+ ops = torch.ops._flashrt_fp8_ffn_rocm_255584f
4
 
5
  def add_op_namespace_prefix(op_name: str):
6
  """
7
  Prefix op by namespace.
8
  """
9
+ return f"_flashrt_fp8_ffn_rocm_255584f::{op_name}"
build/torch211-cxx11-rocm72-x86_64-linux/metadata.json CHANGED
@@ -1,6 +1,6 @@
1
  {
2
  "name": "flashrt-fp8-ffn",
3
- "id": "_flashrt_fp8_ffn_rocm_1b7b2db",
4
  "version": 1,
5
  "license": "Apache-2.0",
6
  "python-depends": [],
 
1
  {
2
  "name": "flashrt-fp8-ffn",
3
+ "id": "_flashrt_fp8_ffn_rocm_255584f",
4
  "version": 1,
5
  "license": "Apache-2.0",
6
  "python-depends": [],
build/torch212-cxx11-cu130-x86_64-linux/__init__.py CHANGED
@@ -55,6 +55,50 @@ def _fp8_gemm_bf16_fake(
55
  return None
56
 
57
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
58
  @torch.library.register_fake(add_op_namespace_prefix("fp8_linear_bias_gelu_quant_bf16"))
59
  def _fp8_linear_bias_gelu_quant_bf16_fake(
60
  input: torch.Tensor,
@@ -157,6 +201,33 @@ def fp8_gemm_bf16(
157
  return out
158
 
159
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
160
  def fp8_linear_bias_gelu_quant_bf16(
161
  input: torch.Tensor,
162
  weight: torch.Tensor,
@@ -260,6 +331,45 @@ def _midm_padded_rows(input: torch.Tensor) -> int:
260
  return rows
261
 
262
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
263
  def bf16_fp8_gelu_mlp_bf16(
264
  input: torch.Tensor,
265
  up_weight: torch.Tensor,
@@ -324,8 +434,10 @@ def bf16_fp8_gelu_mlp_bf16(
324
 
325
 
326
  __all__ = [
 
327
  "bf16_fp8_gelu_mlp_bf16",
328
  "fp8_gemm_bf16",
329
  "fp8_gelu_mlp_bf16",
 
330
  "fp8_linear_bias_gelu_quant_bf16",
331
  ]
 
55
  return None
56
 
57
 
58
+ @torch.library.register_fake(add_op_namespace_prefix("fp8_linear_bias_bf16"))
59
+ def _fp8_linear_bias_bf16_fake(
60
+ input: torch.Tensor,
61
+ weight: torch.Tensor,
62
+ bias: torch.Tensor,
63
+ input_scale: torch.Tensor,
64
+ weight_scale: torch.Tensor,
65
+ out: torch.Tensor,
66
+ ) -> None:
67
+ if input.dim() != 2 or weight.dim() != 2:
68
+ raise RuntimeError("input and weight must be rank-2 tensors")
69
+ if bias.shape != (weight.shape[0],):
70
+ raise RuntimeError("bias shape must be (weight.shape[0],)")
71
+ if out.shape != (input.shape[0], weight.shape[0]):
72
+ raise RuntimeError("out shape must be (input.shape[0], weight.shape[0])")
73
+ return None
74
+
75
+
76
+ @torch.library.register_fake(add_op_namespace_prefix("bf16_fp8_linear_bias_bf16"))
77
+ def _bf16_fp8_linear_bias_bf16_fake(
78
+ input: torch.Tensor,
79
+ weight: torch.Tensor,
80
+ bias: torch.Tensor,
81
+ input_scale: torch.Tensor,
82
+ weight_scale: torch.Tensor,
83
+ input_fp8: torch.Tensor,
84
+ out: torch.Tensor,
85
+ ) -> None:
86
+ if input.dim() != 2 or weight.dim() != 2:
87
+ raise RuntimeError("input and weight must be rank-2 tensors")
88
+ if input.shape[1] != weight.shape[1]:
89
+ raise RuntimeError("input.shape[1] must match weight.shape[1]")
90
+ padded_m = input_fp8.shape[0]
91
+ if padded_m < input.shape[0]:
92
+ raise RuntimeError("input_fp8 padded rows must cover input rows")
93
+ if input_fp8.shape != (padded_m, input.shape[1]):
94
+ raise RuntimeError("input_fp8 must have shape (padded_m, input.shape[1])")
95
+ if bias.shape != (weight.shape[0],):
96
+ raise RuntimeError("bias shape must be (weight.shape[0],)")
97
+ if out.shape != (padded_m, weight.shape[0]):
98
+ raise RuntimeError("out must have shape (padded_m, weight.shape[0])")
99
+ return None
100
+
101
+
102
  @torch.library.register_fake(add_op_namespace_prefix("fp8_linear_bias_gelu_quant_bf16"))
103
  def _fp8_linear_bias_gelu_quant_bf16_fake(
104
  input: torch.Tensor,
 
201
  return out
202
 
203
 
204
+ def fp8_linear_bias_bf16(
205
+ input: torch.Tensor,
206
+ weight: torch.Tensor,
207
+ bias: torch.Tensor,
208
+ input_scale: torch.Tensor,
209
+ weight_scale: torch.Tensor,
210
+ out: torch.Tensor | None = None,
211
+ ) -> torch.Tensor:
212
+ """Run an FP8-weight linear projection with BF16 bias and output.
213
+
214
+ ``input`` and ``weight`` use FP8 E4M3 with shapes ``(M, K)`` and
215
+ ``(N, K)``. Scales are device float32 scalar tensors. Pass ``out`` to keep
216
+ the call allocation-free for CUDA Graph capture.
217
+ """
218
+
219
+ if out is None:
220
+ out = torch.empty(
221
+ (input.shape[0], weight.shape[0]),
222
+ device=input.device,
223
+ dtype=torch.bfloat16,
224
+ )
225
+ ops.fp8_linear_bias_bf16(
226
+ input, weight, bias, input_scale, weight_scale, out
227
+ )
228
+ return out
229
+
230
+
231
  def fp8_linear_bias_gelu_quant_bf16(
232
  input: torch.Tensor,
233
  weight: torch.Tensor,
 
331
  return rows
332
 
333
 
334
+ def bf16_fp8_linear_bias_bf16(
335
+ input: torch.Tensor,
336
+ weight: torch.Tensor,
337
+ bias: torch.Tensor,
338
+ input_scale: torch.Tensor,
339
+ weight_scale: torch.Tensor,
340
+ input_fp8: torch.Tensor | None = None,
341
+ out: torch.Tensor | None = None,
342
+ *,
343
+ pad_to: int | None = None,
344
+ ) -> torch.Tensor:
345
+ """Run a static-scale FP8 linear projection from a BF16 boundary.
346
+
347
+ This traceable region entry quantizes ``input`` and computes the FP8
348
+ projection with BF16 bias/output. Thor SM110 pads M=9..128 to a multiple of
349
+ 64 by default. Preallocate ``input_fp8`` and ``out`` for allocation-free
350
+ CUDA Graph replay.
351
+ """
352
+
353
+ logical_m = input.shape[0]
354
+ padded_m = _midm_padded_rows(input) if pad_to is None else pad_to
355
+ if padded_m < logical_m:
356
+ raise ValueError("pad_to must be >= input.shape[0]")
357
+ if input_fp8 is None:
358
+ input_fp8 = torch.empty(
359
+ (padded_m, input.shape[1]), device=input.device, dtype=_fp8_dtype()
360
+ )
361
+ if out is None:
362
+ out = torch.empty(
363
+ (padded_m, weight.shape[0]),
364
+ device=input.device,
365
+ dtype=torch.bfloat16,
366
+ )
367
+ ops.bf16_fp8_linear_bias_bf16(
368
+ input, weight, bias, input_scale, weight_scale, input_fp8, out
369
+ )
370
+ return out[:logical_m]
371
+
372
+
373
  def bf16_fp8_gelu_mlp_bf16(
374
  input: torch.Tensor,
375
  up_weight: torch.Tensor,
 
434
 
435
 
436
  __all__ = [
437
+ "bf16_fp8_linear_bias_bf16",
438
  "bf16_fp8_gelu_mlp_bf16",
439
  "fp8_gemm_bf16",
440
  "fp8_gelu_mlp_bf16",
441
+ "fp8_linear_bias_bf16",
442
  "fp8_linear_bias_gelu_quant_bf16",
443
  ]
build/torch212-cxx11-cu130-x86_64-linux/_flashrt_fp8_ffn_cuda_1b7b2db.abi3.so DELETED
@@ -1,3 +0,0 @@
1
- version https://git-lfs.github.com/spec/v1
2
- oid sha256:e6978c36e428af2c9fdf149d7f1b54d57716ccff6b9774978e7243f4727f702c
3
- size 646904
 
 
 
 
build/torch212-cxx11-cu130-x86_64-linux/_flashrt_fp8_ffn_cuda_255584f.abi3.so ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:9cf974f0a6585860d33d00d4269205d2046cbaa8e74442d4e289ec8ea7cddc6e
3
+ size 668544
build/torch212-cxx11-cu130-x86_64-linux/_ops.py CHANGED
@@ -1,9 +1,9 @@
1
  import torch
2
- from . import _flashrt_fp8_ffn_cuda_1b7b2db
3
- ops = torch.ops._flashrt_fp8_ffn_cuda_1b7b2db
4
 
5
  def add_op_namespace_prefix(op_name: str):
6
  """
7
  Prefix op by namespace.
8
  """
9
- return f"_flashrt_fp8_ffn_cuda_1b7b2db::{op_name}"
 
1
  import torch
2
+ from . import _flashrt_fp8_ffn_cuda_255584f
3
+ ops = torch.ops._flashrt_fp8_ffn_cuda_255584f
4
 
5
  def add_op_namespace_prefix(op_name: str):
6
  """
7
  Prefix op by namespace.
8
  """
9
+ return f"_flashrt_fp8_ffn_cuda_255584f::{op_name}"
build/torch212-cxx11-cu130-x86_64-linux/metadata.json CHANGED
@@ -1,6 +1,6 @@
1
  {
2
  "name": "flashrt-fp8-ffn",
3
- "id": "_flashrt_fp8_ffn_cuda_1b7b2db",
4
  "version": 1,
5
  "license": "Apache-2.0",
6
  "python-depends": [],
 
1
  {
2
  "name": "flashrt-fp8-ffn",
3
+ "id": "_flashrt_fp8_ffn_cuda_255584f",
4
  "version": 1,
5
  "license": "Apache-2.0",
6
  "python-depends": [],
build/torch212-cxx11-cu132-x86_64-linux/__init__.py CHANGED
@@ -55,6 +55,50 @@ def _fp8_gemm_bf16_fake(
55
  return None
56
 
57
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
58
  @torch.library.register_fake(add_op_namespace_prefix("fp8_linear_bias_gelu_quant_bf16"))
59
  def _fp8_linear_bias_gelu_quant_bf16_fake(
60
  input: torch.Tensor,
@@ -157,6 +201,33 @@ def fp8_gemm_bf16(
157
  return out
158
 
159
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
160
  def fp8_linear_bias_gelu_quant_bf16(
161
  input: torch.Tensor,
162
  weight: torch.Tensor,
@@ -260,6 +331,45 @@ def _midm_padded_rows(input: torch.Tensor) -> int:
260
  return rows
261
 
262
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
263
  def bf16_fp8_gelu_mlp_bf16(
264
  input: torch.Tensor,
265
  up_weight: torch.Tensor,
@@ -324,8 +434,10 @@ def bf16_fp8_gelu_mlp_bf16(
324
 
325
 
326
  __all__ = [
 
327
  "bf16_fp8_gelu_mlp_bf16",
328
  "fp8_gemm_bf16",
329
  "fp8_gelu_mlp_bf16",
 
330
  "fp8_linear_bias_gelu_quant_bf16",
331
  ]
 
55
  return None
56
 
57
 
58
+ @torch.library.register_fake(add_op_namespace_prefix("fp8_linear_bias_bf16"))
59
+ def _fp8_linear_bias_bf16_fake(
60
+ input: torch.Tensor,
61
+ weight: torch.Tensor,
62
+ bias: torch.Tensor,
63
+ input_scale: torch.Tensor,
64
+ weight_scale: torch.Tensor,
65
+ out: torch.Tensor,
66
+ ) -> None:
67
+ if input.dim() != 2 or weight.dim() != 2:
68
+ raise RuntimeError("input and weight must be rank-2 tensors")
69
+ if bias.shape != (weight.shape[0],):
70
+ raise RuntimeError("bias shape must be (weight.shape[0],)")
71
+ if out.shape != (input.shape[0], weight.shape[0]):
72
+ raise RuntimeError("out shape must be (input.shape[0], weight.shape[0])")
73
+ return None
74
+
75
+
76
+ @torch.library.register_fake(add_op_namespace_prefix("bf16_fp8_linear_bias_bf16"))
77
+ def _bf16_fp8_linear_bias_bf16_fake(
78
+ input: torch.Tensor,
79
+ weight: torch.Tensor,
80
+ bias: torch.Tensor,
81
+ input_scale: torch.Tensor,
82
+ weight_scale: torch.Tensor,
83
+ input_fp8: torch.Tensor,
84
+ out: torch.Tensor,
85
+ ) -> None:
86
+ if input.dim() != 2 or weight.dim() != 2:
87
+ raise RuntimeError("input and weight must be rank-2 tensors")
88
+ if input.shape[1] != weight.shape[1]:
89
+ raise RuntimeError("input.shape[1] must match weight.shape[1]")
90
+ padded_m = input_fp8.shape[0]
91
+ if padded_m < input.shape[0]:
92
+ raise RuntimeError("input_fp8 padded rows must cover input rows")
93
+ if input_fp8.shape != (padded_m, input.shape[1]):
94
+ raise RuntimeError("input_fp8 must have shape (padded_m, input.shape[1])")
95
+ if bias.shape != (weight.shape[0],):
96
+ raise RuntimeError("bias shape must be (weight.shape[0],)")
97
+ if out.shape != (padded_m, weight.shape[0]):
98
+ raise RuntimeError("out must have shape (padded_m, weight.shape[0])")
99
+ return None
100
+
101
+
102
  @torch.library.register_fake(add_op_namespace_prefix("fp8_linear_bias_gelu_quant_bf16"))
103
  def _fp8_linear_bias_gelu_quant_bf16_fake(
104
  input: torch.Tensor,
 
201
  return out
202
 
203
 
204
+ def fp8_linear_bias_bf16(
205
+ input: torch.Tensor,
206
+ weight: torch.Tensor,
207
+ bias: torch.Tensor,
208
+ input_scale: torch.Tensor,
209
+ weight_scale: torch.Tensor,
210
+ out: torch.Tensor | None = None,
211
+ ) -> torch.Tensor:
212
+ """Run an FP8-weight linear projection with BF16 bias and output.
213
+
214
+ ``input`` and ``weight`` use FP8 E4M3 with shapes ``(M, K)`` and
215
+ ``(N, K)``. Scales are device float32 scalar tensors. Pass ``out`` to keep
216
+ the call allocation-free for CUDA Graph capture.
217
+ """
218
+
219
+ if out is None:
220
+ out = torch.empty(
221
+ (input.shape[0], weight.shape[0]),
222
+ device=input.device,
223
+ dtype=torch.bfloat16,
224
+ )
225
+ ops.fp8_linear_bias_bf16(
226
+ input, weight, bias, input_scale, weight_scale, out
227
+ )
228
+ return out
229
+
230
+
231
  def fp8_linear_bias_gelu_quant_bf16(
232
  input: torch.Tensor,
233
  weight: torch.Tensor,
 
331
  return rows
332
 
333
 
334
+ def bf16_fp8_linear_bias_bf16(
335
+ input: torch.Tensor,
336
+ weight: torch.Tensor,
337
+ bias: torch.Tensor,
338
+ input_scale: torch.Tensor,
339
+ weight_scale: torch.Tensor,
340
+ input_fp8: torch.Tensor | None = None,
341
+ out: torch.Tensor | None = None,
342
+ *,
343
+ pad_to: int | None = None,
344
+ ) -> torch.Tensor:
345
+ """Run a static-scale FP8 linear projection from a BF16 boundary.
346
+
347
+ This traceable region entry quantizes ``input`` and computes the FP8
348
+ projection with BF16 bias/output. Thor SM110 pads M=9..128 to a multiple of
349
+ 64 by default. Preallocate ``input_fp8`` and ``out`` for allocation-free
350
+ CUDA Graph replay.
351
+ """
352
+
353
+ logical_m = input.shape[0]
354
+ padded_m = _midm_padded_rows(input) if pad_to is None else pad_to
355
+ if padded_m < logical_m:
356
+ raise ValueError("pad_to must be >= input.shape[0]")
357
+ if input_fp8 is None:
358
+ input_fp8 = torch.empty(
359
+ (padded_m, input.shape[1]), device=input.device, dtype=_fp8_dtype()
360
+ )
361
+ if out is None:
362
+ out = torch.empty(
363
+ (padded_m, weight.shape[0]),
364
+ device=input.device,
365
+ dtype=torch.bfloat16,
366
+ )
367
+ ops.bf16_fp8_linear_bias_bf16(
368
+ input, weight, bias, input_scale, weight_scale, input_fp8, out
369
+ )
370
+ return out[:logical_m]
371
+
372
+
373
  def bf16_fp8_gelu_mlp_bf16(
374
  input: torch.Tensor,
375
  up_weight: torch.Tensor,
 
434
 
435
 
436
  __all__ = [
437
+ "bf16_fp8_linear_bias_bf16",
438
  "bf16_fp8_gelu_mlp_bf16",
439
  "fp8_gemm_bf16",
440
  "fp8_gelu_mlp_bf16",
441
+ "fp8_linear_bias_bf16",
442
  "fp8_linear_bias_gelu_quant_bf16",
443
  ]
build/torch212-cxx11-cu132-x86_64-linux/_flashrt_fp8_ffn_cuda_1b7b2db.abi3.so DELETED
@@ -1,3 +0,0 @@
1
- version https://git-lfs.github.com/spec/v1
2
- oid sha256:4637937fd2244ac510d7f7726f7597f780e08932d5efbb4d73d7e3a807073e80
3
- size 651000
 
 
 
 
build/torch212-cxx11-cu132-x86_64-linux/_flashrt_fp8_ffn_cuda_255584f.abi3.so ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:92f9e9ba898c08f78f8ea086de134a0f1dcfb1201ce9d04ca932d4ed30844919
3
+ size 668544
build/torch212-cxx11-cu132-x86_64-linux/_ops.py CHANGED
@@ -1,9 +1,9 @@
1
  import torch
2
- from . import _flashrt_fp8_ffn_cuda_1b7b2db
3
- ops = torch.ops._flashrt_fp8_ffn_cuda_1b7b2db
4
 
5
  def add_op_namespace_prefix(op_name: str):
6
  """
7
  Prefix op by namespace.
8
  """
9
- return f"_flashrt_fp8_ffn_cuda_1b7b2db::{op_name}"
 
1
  import torch
2
+ from . import _flashrt_fp8_ffn_cuda_255584f
3
+ ops = torch.ops._flashrt_fp8_ffn_cuda_255584f
4
 
5
  def add_op_namespace_prefix(op_name: str):
6
  """
7
  Prefix op by namespace.
8
  """
9
+ return f"_flashrt_fp8_ffn_cuda_255584f::{op_name}"
build/torch212-cxx11-cu132-x86_64-linux/metadata.json CHANGED
@@ -1,6 +1,6 @@
1
  {
2
  "name": "flashrt-fp8-ffn",
3
- "id": "_flashrt_fp8_ffn_cuda_1b7b2db",
4
  "version": 1,
5
  "license": "Apache-2.0",
6
  "python-depends": [],
 
1
  {
2
  "name": "flashrt-fp8-ffn",
3
+ "id": "_flashrt_fp8_ffn_cuda_255584f",
4
  "version": 1,
5
  "license": "Apache-2.0",
6
  "python-depends": [],
build/torch212-cxx11-rocm71-x86_64-linux/__init__.py CHANGED
@@ -55,6 +55,50 @@ def _fp8_gemm_bf16_fake(
55
  return None
56
 
57
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
58
  @torch.library.register_fake(add_op_namespace_prefix("fp8_linear_bias_gelu_quant_bf16"))
59
  def _fp8_linear_bias_gelu_quant_bf16_fake(
60
  input: torch.Tensor,
@@ -157,6 +201,33 @@ def fp8_gemm_bf16(
157
  return out
158
 
159
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
160
  def fp8_linear_bias_gelu_quant_bf16(
161
  input: torch.Tensor,
162
  weight: torch.Tensor,
@@ -260,6 +331,45 @@ def _midm_padded_rows(input: torch.Tensor) -> int:
260
  return rows
261
 
262
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
263
  def bf16_fp8_gelu_mlp_bf16(
264
  input: torch.Tensor,
265
  up_weight: torch.Tensor,
@@ -324,8 +434,10 @@ def bf16_fp8_gelu_mlp_bf16(
324
 
325
 
326
  __all__ = [
 
327
  "bf16_fp8_gelu_mlp_bf16",
328
  "fp8_gemm_bf16",
329
  "fp8_gelu_mlp_bf16",
 
330
  "fp8_linear_bias_gelu_quant_bf16",
331
  ]
 
55
  return None
56
 
57
 
58
+ @torch.library.register_fake(add_op_namespace_prefix("fp8_linear_bias_bf16"))
59
+ def _fp8_linear_bias_bf16_fake(
60
+ input: torch.Tensor,
61
+ weight: torch.Tensor,
62
+ bias: torch.Tensor,
63
+ input_scale: torch.Tensor,
64
+ weight_scale: torch.Tensor,
65
+ out: torch.Tensor,
66
+ ) -> None:
67
+ if input.dim() != 2 or weight.dim() != 2:
68
+ raise RuntimeError("input and weight must be rank-2 tensors")
69
+ if bias.shape != (weight.shape[0],):
70
+ raise RuntimeError("bias shape must be (weight.shape[0],)")
71
+ if out.shape != (input.shape[0], weight.shape[0]):
72
+ raise RuntimeError("out shape must be (input.shape[0], weight.shape[0])")
73
+ return None
74
+
75
+
76
+ @torch.library.register_fake(add_op_namespace_prefix("bf16_fp8_linear_bias_bf16"))
77
+ def _bf16_fp8_linear_bias_bf16_fake(
78
+ input: torch.Tensor,
79
+ weight: torch.Tensor,
80
+ bias: torch.Tensor,
81
+ input_scale: torch.Tensor,
82
+ weight_scale: torch.Tensor,
83
+ input_fp8: torch.Tensor,
84
+ out: torch.Tensor,
85
+ ) -> None:
86
+ if input.dim() != 2 or weight.dim() != 2:
87
+ raise RuntimeError("input and weight must be rank-2 tensors")
88
+ if input.shape[1] != weight.shape[1]:
89
+ raise RuntimeError("input.shape[1] must match weight.shape[1]")
90
+ padded_m = input_fp8.shape[0]
91
+ if padded_m < input.shape[0]:
92
+ raise RuntimeError("input_fp8 padded rows must cover input rows")
93
+ if input_fp8.shape != (padded_m, input.shape[1]):
94
+ raise RuntimeError("input_fp8 must have shape (padded_m, input.shape[1])")
95
+ if bias.shape != (weight.shape[0],):
96
+ raise RuntimeError("bias shape must be (weight.shape[0],)")
97
+ if out.shape != (padded_m, weight.shape[0]):
98
+ raise RuntimeError("out must have shape (padded_m, weight.shape[0])")
99
+ return None
100
+
101
+
102
  @torch.library.register_fake(add_op_namespace_prefix("fp8_linear_bias_gelu_quant_bf16"))
103
  def _fp8_linear_bias_gelu_quant_bf16_fake(
104
  input: torch.Tensor,
 
201
  return out
202
 
203
 
204
+ def fp8_linear_bias_bf16(
205
+ input: torch.Tensor,
206
+ weight: torch.Tensor,
207
+ bias: torch.Tensor,
208
+ input_scale: torch.Tensor,
209
+ weight_scale: torch.Tensor,
210
+ out: torch.Tensor | None = None,
211
+ ) -> torch.Tensor:
212
+ """Run an FP8-weight linear projection with BF16 bias and output.
213
+
214
+ ``input`` and ``weight`` use FP8 E4M3 with shapes ``(M, K)`` and
215
+ ``(N, K)``. Scales are device float32 scalar tensors. Pass ``out`` to keep
216
+ the call allocation-free for CUDA Graph capture.
217
+ """
218
+
219
+ if out is None:
220
+ out = torch.empty(
221
+ (input.shape[0], weight.shape[0]),
222
+ device=input.device,
223
+ dtype=torch.bfloat16,
224
+ )
225
+ ops.fp8_linear_bias_bf16(
226
+ input, weight, bias, input_scale, weight_scale, out
227
+ )
228
+ return out
229
+
230
+
231
  def fp8_linear_bias_gelu_quant_bf16(
232
  input: torch.Tensor,
233
  weight: torch.Tensor,
 
331
  return rows
332
 
333
 
334
+ def bf16_fp8_linear_bias_bf16(
335
+ input: torch.Tensor,
336
+ weight: torch.Tensor,
337
+ bias: torch.Tensor,
338
+ input_scale: torch.Tensor,
339
+ weight_scale: torch.Tensor,
340
+ input_fp8: torch.Tensor | None = None,
341
+ out: torch.Tensor | None = None,
342
+ *,
343
+ pad_to: int | None = None,
344
+ ) -> torch.Tensor:
345
+ """Run a static-scale FP8 linear projection from a BF16 boundary.
346
+
347
+ This traceable region entry quantizes ``input`` and computes the FP8
348
+ projection with BF16 bias/output. Thor SM110 pads M=9..128 to a multiple of
349
+ 64 by default. Preallocate ``input_fp8`` and ``out`` for allocation-free
350
+ CUDA Graph replay.
351
+ """
352
+
353
+ logical_m = input.shape[0]
354
+ padded_m = _midm_padded_rows(input) if pad_to is None else pad_to
355
+ if padded_m < logical_m:
356
+ raise ValueError("pad_to must be >= input.shape[0]")
357
+ if input_fp8 is None:
358
+ input_fp8 = torch.empty(
359
+ (padded_m, input.shape[1]), device=input.device, dtype=_fp8_dtype()
360
+ )
361
+ if out is None:
362
+ out = torch.empty(
363
+ (padded_m, weight.shape[0]),
364
+ device=input.device,
365
+ dtype=torch.bfloat16,
366
+ )
367
+ ops.bf16_fp8_linear_bias_bf16(
368
+ input, weight, bias, input_scale, weight_scale, input_fp8, out
369
+ )
370
+ return out[:logical_m]
371
+
372
+
373
  def bf16_fp8_gelu_mlp_bf16(
374
  input: torch.Tensor,
375
  up_weight: torch.Tensor,
 
434
 
435
 
436
  __all__ = [
437
+ "bf16_fp8_linear_bias_bf16",
438
  "bf16_fp8_gelu_mlp_bf16",
439
  "fp8_gemm_bf16",
440
  "fp8_gelu_mlp_bf16",
441
+ "fp8_linear_bias_bf16",
442
  "fp8_linear_bias_gelu_quant_bf16",
443
  ]
build/torch212-cxx11-rocm71-x86_64-linux/_flashrt_fp8_ffn_rocm_1b7b2db.abi3.so DELETED
@@ -1,3 +0,0 @@
1
- version https://git-lfs.github.com/spec/v1
2
- oid sha256:fc1a84a2ee5b267602af0160dcc3c32705259d5c754846eb36b9f724c5e727bf
3
- size 167224
 
 
 
 
build/torch212-cxx11-rocm71-x86_64-linux/_flashrt_fp8_ffn_rocm_255584f.abi3.so ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:6203acdac17af6b44944b57bb831a4584a39b8ad401f0e8cd58a7c2b5760862e
3
+ size 180000
build/torch212-cxx11-rocm71-x86_64-linux/_ops.py CHANGED
@@ -1,9 +1,9 @@
1
  import torch
2
- from . import _flashrt_fp8_ffn_rocm_1b7b2db
3
- ops = torch.ops._flashrt_fp8_ffn_rocm_1b7b2db
4
 
5
  def add_op_namespace_prefix(op_name: str):
6
  """
7
  Prefix op by namespace.
8
  """
9
- return f"_flashrt_fp8_ffn_rocm_1b7b2db::{op_name}"
 
1
  import torch
2
+ from . import _flashrt_fp8_ffn_rocm_255584f
3
+ ops = torch.ops._flashrt_fp8_ffn_rocm_255584f
4
 
5
  def add_op_namespace_prefix(op_name: str):
6
  """
7
  Prefix op by namespace.
8
  """
9
+ return f"_flashrt_fp8_ffn_rocm_255584f::{op_name}"
build/torch212-cxx11-rocm71-x86_64-linux/metadata.json CHANGED
@@ -1,6 +1,6 @@
1
  {
2
  "name": "flashrt-fp8-ffn",
3
- "id": "_flashrt_fp8_ffn_rocm_1b7b2db",
4
  "version": 1,
5
  "license": "Apache-2.0",
6
  "python-depends": [],
 
1
  {
2
  "name": "flashrt-fp8-ffn",
3
+ "id": "_flashrt_fp8_ffn_rocm_255584f",
4
  "version": 1,
5
  "license": "Apache-2.0",
6
  "python-depends": [],
build/torch212-cxx11-rocm72-x86_64-linux/__init__.py CHANGED
@@ -55,6 +55,50 @@ def _fp8_gemm_bf16_fake(
55
  return None
56
 
57
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
58
  @torch.library.register_fake(add_op_namespace_prefix("fp8_linear_bias_gelu_quant_bf16"))
59
  def _fp8_linear_bias_gelu_quant_bf16_fake(
60
  input: torch.Tensor,
@@ -157,6 +201,33 @@ def fp8_gemm_bf16(
157
  return out
158
 
159
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
160
  def fp8_linear_bias_gelu_quant_bf16(
161
  input: torch.Tensor,
162
  weight: torch.Tensor,
@@ -260,6 +331,45 @@ def _midm_padded_rows(input: torch.Tensor) -> int:
260
  return rows
261
 
262
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
263
  def bf16_fp8_gelu_mlp_bf16(
264
  input: torch.Tensor,
265
  up_weight: torch.Tensor,
@@ -324,8 +434,10 @@ def bf16_fp8_gelu_mlp_bf16(
324
 
325
 
326
  __all__ = [
 
327
  "bf16_fp8_gelu_mlp_bf16",
328
  "fp8_gemm_bf16",
329
  "fp8_gelu_mlp_bf16",
 
330
  "fp8_linear_bias_gelu_quant_bf16",
331
  ]
 
55
  return None
56
 
57
 
58
+ @torch.library.register_fake(add_op_namespace_prefix("fp8_linear_bias_bf16"))
59
+ def _fp8_linear_bias_bf16_fake(
60
+ input: torch.Tensor,
61
+ weight: torch.Tensor,
62
+ bias: torch.Tensor,
63
+ input_scale: torch.Tensor,
64
+ weight_scale: torch.Tensor,
65
+ out: torch.Tensor,
66
+ ) -> None:
67
+ if input.dim() != 2 or weight.dim() != 2:
68
+ raise RuntimeError("input and weight must be rank-2 tensors")
69
+ if bias.shape != (weight.shape[0],):
70
+ raise RuntimeError("bias shape must be (weight.shape[0],)")
71
+ if out.shape != (input.shape[0], weight.shape[0]):
72
+ raise RuntimeError("out shape must be (input.shape[0], weight.shape[0])")
73
+ return None
74
+
75
+
76
+ @torch.library.register_fake(add_op_namespace_prefix("bf16_fp8_linear_bias_bf16"))
77
+ def _bf16_fp8_linear_bias_bf16_fake(
78
+ input: torch.Tensor,
79
+ weight: torch.Tensor,
80
+ bias: torch.Tensor,
81
+ input_scale: torch.Tensor,
82
+ weight_scale: torch.Tensor,
83
+ input_fp8: torch.Tensor,
84
+ out: torch.Tensor,
85
+ ) -> None:
86
+ if input.dim() != 2 or weight.dim() != 2:
87
+ raise RuntimeError("input and weight must be rank-2 tensors")
88
+ if input.shape[1] != weight.shape[1]:
89
+ raise RuntimeError("input.shape[1] must match weight.shape[1]")
90
+ padded_m = input_fp8.shape[0]
91
+ if padded_m < input.shape[0]:
92
+ raise RuntimeError("input_fp8 padded rows must cover input rows")
93
+ if input_fp8.shape != (padded_m, input.shape[1]):
94
+ raise RuntimeError("input_fp8 must have shape (padded_m, input.shape[1])")
95
+ if bias.shape != (weight.shape[0],):
96
+ raise RuntimeError("bias shape must be (weight.shape[0],)")
97
+ if out.shape != (padded_m, weight.shape[0]):
98
+ raise RuntimeError("out must have shape (padded_m, weight.shape[0])")
99
+ return None
100
+
101
+
102
  @torch.library.register_fake(add_op_namespace_prefix("fp8_linear_bias_gelu_quant_bf16"))
103
  def _fp8_linear_bias_gelu_quant_bf16_fake(
104
  input: torch.Tensor,
 
201
  return out
202
 
203
 
204
+ def fp8_linear_bias_bf16(
205
+ input: torch.Tensor,
206
+ weight: torch.Tensor,
207
+ bias: torch.Tensor,
208
+ input_scale: torch.Tensor,
209
+ weight_scale: torch.Tensor,
210
+ out: torch.Tensor | None = None,
211
+ ) -> torch.Tensor:
212
+ """Run an FP8-weight linear projection with BF16 bias and output.
213
+
214
+ ``input`` and ``weight`` use FP8 E4M3 with shapes ``(M, K)`` and
215
+ ``(N, K)``. Scales are device float32 scalar tensors. Pass ``out`` to keep
216
+ the call allocation-free for CUDA Graph capture.
217
+ """
218
+
219
+ if out is None:
220
+ out = torch.empty(
221
+ (input.shape[0], weight.shape[0]),
222
+ device=input.device,
223
+ dtype=torch.bfloat16,
224
+ )
225
+ ops.fp8_linear_bias_bf16(
226
+ input, weight, bias, input_scale, weight_scale, out
227
+ )
228
+ return out
229
+
230
+
231
  def fp8_linear_bias_gelu_quant_bf16(
232
  input: torch.Tensor,
233
  weight: torch.Tensor,
 
331
  return rows
332
 
333
 
334
+ def bf16_fp8_linear_bias_bf16(
335
+ input: torch.Tensor,
336
+ weight: torch.Tensor,
337
+ bias: torch.Tensor,
338
+ input_scale: torch.Tensor,
339
+ weight_scale: torch.Tensor,
340
+ input_fp8: torch.Tensor | None = None,
341
+ out: torch.Tensor | None = None,
342
+ *,
343
+ pad_to: int | None = None,
344
+ ) -> torch.Tensor:
345
+ """Run a static-scale FP8 linear projection from a BF16 boundary.
346
+
347
+ This traceable region entry quantizes ``input`` and computes the FP8
348
+ projection with BF16 bias/output. Thor SM110 pads M=9..128 to a multiple of
349
+ 64 by default. Preallocate ``input_fp8`` and ``out`` for allocation-free
350
+ CUDA Graph replay.
351
+ """
352
+
353
+ logical_m = input.shape[0]
354
+ padded_m = _midm_padded_rows(input) if pad_to is None else pad_to
355
+ if padded_m < logical_m:
356
+ raise ValueError("pad_to must be >= input.shape[0]")
357
+ if input_fp8 is None:
358
+ input_fp8 = torch.empty(
359
+ (padded_m, input.shape[1]), device=input.device, dtype=_fp8_dtype()
360
+ )
361
+ if out is None:
362
+ out = torch.empty(
363
+ (padded_m, weight.shape[0]),
364
+ device=input.device,
365
+ dtype=torch.bfloat16,
366
+ )
367
+ ops.bf16_fp8_linear_bias_bf16(
368
+ input, weight, bias, input_scale, weight_scale, input_fp8, out
369
+ )
370
+ return out[:logical_m]
371
+
372
+
373
  def bf16_fp8_gelu_mlp_bf16(
374
  input: torch.Tensor,
375
  up_weight: torch.Tensor,
 
434
 
435
 
436
  __all__ = [
437
+ "bf16_fp8_linear_bias_bf16",
438
  "bf16_fp8_gelu_mlp_bf16",
439
  "fp8_gemm_bf16",
440
  "fp8_gelu_mlp_bf16",
441
+ "fp8_linear_bias_bf16",
442
  "fp8_linear_bias_gelu_quant_bf16",
443
  ]
build/torch212-cxx11-rocm72-x86_64-linux/_flashrt_fp8_ffn_rocm_1b7b2db.abi3.so DELETED
@@ -1,3 +0,0 @@
1
- version https://git-lfs.github.com/spec/v1
2
- oid sha256:b3802296ac516bab2ca9c316f5d32255e08c3fb9a039d1f49099fc2b85a3797b
3
- size 165656
 
 
 
 
build/torch212-cxx11-rocm72-x86_64-linux/_flashrt_fp8_ffn_rocm_255584f.abi3.so ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:eb09062fde7313db39fe558ff36f8b902b04ac06fade78310ccd1eb27ad3d90b
3
+ size 178424
build/torch212-cxx11-rocm72-x86_64-linux/_ops.py CHANGED
@@ -1,9 +1,9 @@
1
  import torch
2
- from . import _flashrt_fp8_ffn_rocm_1b7b2db
3
- ops = torch.ops._flashrt_fp8_ffn_rocm_1b7b2db
4
 
5
  def add_op_namespace_prefix(op_name: str):
6
  """
7
  Prefix op by namespace.
8
  """
9
- return f"_flashrt_fp8_ffn_rocm_1b7b2db::{op_name}"
 
1
  import torch
2
+ from . import _flashrt_fp8_ffn_rocm_255584f
3
+ ops = torch.ops._flashrt_fp8_ffn_rocm_255584f
4
 
5
  def add_op_namespace_prefix(op_name: str):
6
  """
7
  Prefix op by namespace.
8
  """
9
+ return f"_flashrt_fp8_ffn_rocm_255584f::{op_name}"
build/torch212-cxx11-rocm72-x86_64-linux/metadata.json CHANGED
@@ -1,6 +1,6 @@
1
  {
2
  "name": "flashrt-fp8-ffn",
3
- "id": "_flashrt_fp8_ffn_rocm_1b7b2db",
4
  "version": 1,
5
  "license": "Apache-2.0",
6
  "python-depends": [],
 
1
  {
2
  "name": "flashrt-fp8-ffn",
3
+ "id": "_flashrt_fp8_ffn_rocm_255584f",
4
  "version": 1,
5
  "license": "Apache-2.0",
6
  "python-depends": [],