liangsu9988 commited on
Commit
d5b8d21
·
verified ·
1 Parent(s): 9d5a48b

Uploaded using `kernel-builder`.

Browse files
build/torch212-cxx11-cu130-x86_64-linux/__init__.py CHANGED
@@ -11,8 +11,9 @@ import torch
11
  from ._ops import add_op_namespace_prefix, ops
12
 
13
 
14
- SUPPORTED_HEAD_DIMS = (64, 96, 128, 256)
15
- SPLIT_HEAD_DIMS = (96, 128, 256)
 
16
 
17
 
18
  @dataclass(frozen=True)
@@ -43,7 +44,7 @@ def recommended_num_splits(
43
  if any(int(v) <= 0 for v in values):
44
  raise ValueError("all shape values and num_sms must be positive")
45
  if int(head_dim) not in SUPPORTED_HEAD_DIMS:
46
- raise ValueError(f"head_dim must be one of {SUPPORTED_HEAD_DIMS}")
47
  block_n = 256 if head_dim <= 64 else (128 if head_dim <= 128 else 64)
48
  n_blocks = _ceildiv(seqlen_k, block_n)
49
  m_blocks = _ceildiv(seqlen_q, 64)
@@ -82,8 +83,8 @@ def allocate_workspace(
82
 
83
  if q.ndim != 4 or k.ndim != 4:
84
  raise ValueError("q and k must have shape (B, S, H, D)")
85
- if q.shape[-1] not in SPLIT_HEAD_DIMS:
86
- return None
87
  if num_sms is None:
88
  num_sms = torch.cuda.get_device_properties(q.device).multi_processor_count
89
  splits = recommended_num_splits(
@@ -96,8 +97,9 @@ def allocate_workspace(
96
  device=q.device,
97
  dtype=torch.float32,
98
  )
 
99
  out = torch.empty(
100
- (splits, q.shape[0], q.shape[2], q.shape[1], q.shape[3]),
101
  device=q.device,
102
  dtype=torch.float32,
103
  )
@@ -273,6 +275,7 @@ def forward(
273
 
274
  __all__ = [
275
  "FA2Workspace",
 
276
  "SPLIT_HEAD_DIMS",
277
  "SUPPORTED_HEAD_DIMS",
278
  "allocate_outputs",
 
11
  from ._ops import add_op_namespace_prefix, ops
12
 
13
 
14
+ SUPPORTED_HEAD_DIMS = tuple(range(8, 257, 8))
15
+ COMPILED_HEAD_DIM_BUCKETS = (64, 96, 128, 256)
16
+ SPLIT_HEAD_DIMS = SUPPORTED_HEAD_DIMS
17
 
18
 
19
  @dataclass(frozen=True)
 
44
  if any(int(v) <= 0 for v in values):
45
  raise ValueError("all shape values and num_sms must be positive")
46
  if int(head_dim) not in SUPPORTED_HEAD_DIMS:
47
+ raise ValueError("head_dim must be a positive multiple of 8 at most 256")
48
  block_n = 256 if head_dim <= 64 else (128 if head_dim <= 128 else 64)
49
  n_blocks = _ceildiv(seqlen_k, block_n)
50
  m_blocks = _ceildiv(seqlen_q, 64)
 
83
 
84
  if q.ndim != 4 or k.ndim != 4:
85
  raise ValueError("q and k must have shape (B, S, H, D)")
86
+ if q.shape[-1] not in SUPPORTED_HEAD_DIMS:
87
+ raise ValueError("head_dim must be a positive multiple of 8 at most 256")
88
  if num_sms is None:
89
  num_sms = torch.cuda.get_device_properties(q.device).multi_processor_count
90
  splits = recommended_num_splits(
 
97
  device=q.device,
98
  dtype=torch.float32,
99
  )
100
+ d_rounded = (q.shape[3] + 31) & ~31
101
  out = torch.empty(
102
+ (splits, q.shape[0], q.shape[2], q.shape[1], d_rounded),
103
  device=q.device,
104
  dtype=torch.float32,
105
  )
 
275
 
276
  __all__ = [
277
  "FA2Workspace",
278
+ "COMPILED_HEAD_DIM_BUCKETS",
279
  "SPLIT_HEAD_DIMS",
280
  "SUPPORTED_HEAD_DIMS",
281
  "allocate_outputs",
build/torch212-cxx11-cu130-x86_64-linux/{_fa2_seqused_runtime_cuda_61bef7e.abi3.so → _fa2_seqused_runtime_cuda_99d26a1.abi3.so} RENAMED
@@ -1,3 +1,3 @@
1
  version https://git-lfs.github.com/spec/v1
2
- oid sha256:31ade01e2d39da172b84c435c935055ffed2cf25ecf9378ee46e6a3129350a1f
3
- size 358213904
 
1
  version https://git-lfs.github.com/spec/v1
2
+ oid sha256:e1dbed8b07d0ee1d5a45c1eba6cf7604b1d234a419f74e4d72554e09456224e6
3
+ size 374479568
build/torch212-cxx11-cu130-x86_64-linux/_ops.py CHANGED
@@ -1,9 +1,9 @@
1
  import torch
2
- from . import _fa2_seqused_runtime_cuda_61bef7e
3
- ops = torch.ops._fa2_seqused_runtime_cuda_61bef7e
4
 
5
  def add_op_namespace_prefix(op_name: str):
6
  """
7
  Prefix op by namespace.
8
  """
9
- return f"_fa2_seqused_runtime_cuda_61bef7e::{op_name}"
 
1
  import torch
2
+ from . import _fa2_seqused_runtime_cuda_99d26a1
3
+ ops = torch.ops._fa2_seqused_runtime_cuda_99d26a1
4
 
5
  def add_op_namespace_prefix(op_name: str):
6
  """
7
  Prefix op by namespace.
8
  """
9
+ return f"_fa2_seqused_runtime_cuda_99d26a1::{op_name}"
build/torch212-cxx11-cu130-x86_64-linux/metadata.json CHANGED
@@ -1,6 +1,6 @@
1
  {
2
  "name": "fa2-seqused-runtime",
3
- "id": "_fa2_seqused_runtime_cuda_61bef7e",
4
  "version": 1,
5
  "license": "BSD-3-Clause",
6
  "python-depends": [],
@@ -16,9 +16,9 @@
16
  "digest": {
17
  "algorithm": "sha256",
18
  "files": {
19
- "__init__.py": "ck4+/aHijqRRXtVYRzkkIj7bHwvMxxOEnRIKVQSkd6k=",
20
- "_fa2_seqused_runtime_cuda_61bef7e.abi3.so": "Ma3gHi052hcrhMQ1yTUFX/7SzyXs+TeO5G5qMSk1Ch8=",
21
- "_ops.py": "S5eXSORqSBWo6D7FltYgk8ttuDlbt6lSeHd0GmU8q6U=",
22
  "fa2_seqused_runtime/__init__.py": "DFYPlrhXwYjEqCl/8n0SmWGZV8NFml5DPhMjKfv98GY="
23
  }
24
  }
 
1
  {
2
  "name": "fa2-seqused-runtime",
3
+ "id": "_fa2_seqused_runtime_cuda_99d26a1",
4
  "version": 1,
5
  "license": "BSD-3-Clause",
6
  "python-depends": [],
 
16
  "digest": {
17
  "algorithm": "sha256",
18
  "files": {
19
+ "__init__.py": "zaIQDw3dhB5xbCQPrZ9tGWr/Z559+ooyZOaGIa2/+LQ=",
20
+ "_fa2_seqused_runtime_cuda_99d26a1.abi3.so": "4dvtiwfQ7h1aRcHrps92BLHSNKQZ905NclVOCUViJOY=",
21
+ "_ops.py": "3zmyZsIXRYN9PWXNasLSKultcD9S0IaBbtFEFMbUth0=",
22
  "fa2_seqused_runtime/__init__.py": "DFYPlrhXwYjEqCl/8n0SmWGZV8NFml5DPhMjKfv98GY="
23
  }
24
  }