1717
1818namespace infini ::ops {
1919
20- // Rotary position embedding via aclnnApplyRotaryPosEmbV2.
20+ // Rotary position embedding via ` aclnnApplyRotaryPosEmbV2` .
2121//
2222// V2 handles Q and K simultaneously in a single inplace call (layout=4, TND).
2323// The `rotaryMode` parameter accepts "half", "interleave", or "quarter", but
@@ -42,12 +42,13 @@ class Operator<RotaryEmbedding, Device::Type::kAscend>
4242 : RotaryEmbedding(positions, query, key, cos_sin_cache, head_size,
4343 rotary_dim, is_neox_style, query_out, key_out) {
4444 assert (rotary_dim == head_size &&
45- " Ascend `RotaryEmbedding` requires rotary_dim == head_size "
45+ " ascend `RotaryEmbedding` requires ` rotary_dim` == ` head_size` "
4646 " (partial rotation not supported)" );
4747 assert (is_neox_style &&
48- " Ascend `RotaryEmbedding` requires neox style — "
49- " aclnnApplyRotaryPosEmbV2 rotaryMode only supports \" half\" ; "
50- " \" interleave\" and \" quarter\" return ACLNN_ERR_PARAM_INVALID" );
48+ " ascend `RotaryEmbedding` requires neox style — "
49+ " `aclnnApplyRotaryPosEmbV2` `rotaryMode` only supports "
50+ " \" half\" ; \" interleave\" and \" quarter\" return "
51+ " `ACLNN_ERR_PARAM_INVALID`" );
5152
5253 const int64_t max_seq_len = cos_sin_cache.size (0 );
5354 const int64_t D = head_size_;
@@ -101,7 +102,7 @@ class Operator<RotaryEmbedding, Device::Type::kAscend>
101102 const int64_t Nkv = num_kv_heads_;
102103 aclDataType acl_dt = ascend::toAclDtype (query.dtype ());
103104
104- // Gathered cos/sin buffers [T, D] — filled by aclnnIndexSelect each call.
105+ // Gathered cos/sin buffers [T, D] — filled by ` aclnnIndexSelect` each call.
105106 size_t gathered_bytes = static_cast <size_t >(T * D) * elem_sz;
106107 aclrtMalloc (&cos_dev_, gathered_bytes, ACL_MEM_MALLOC_NORMAL_ONLY);
107108 aclrtMalloc (&sin_dev_, gathered_bytes, ACL_MEM_MALLOC_NORMAL_ONLY);
@@ -147,7 +148,7 @@ class Operator<RotaryEmbedding, Device::Type::kAscend>
147148 const int64_t Nkv = key.size (1 );
148149 const int64_t D = head_size;
149150
150- // Step 1: Gather cos/sin by positions via aclnnIndexSelect (async).
151+ // Step 1: Gather cos/sin by positions via ` aclnnIndexSelect` (async).
151152 {
152153 auto t_cos_table = cos_table_cache_.get (cos_table_dev_);
153154 auto t_sin_table = sin_table_cache_.get (sin_table_dev_);
0 commit comments