Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
jerrrrry
infinicore
Commits
0fdaa522
Commit
0fdaa522
authored
Apr 03, 2025
by
zhangyue
Browse files
mv atomic_add function to common_kunlun.h
parent
4d745cf9
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
11 additions
and
11 deletions
+11
-11
src/infiniop/devices/kunlun/kunlun_common.h
src/infiniop/devices/kunlun/kunlun_common.h
+11
-1
src/infiniop/ops/rms_norm/kunlun/rms_norm_kernel.xpu
src/infiniop/ops/rms_norm/kunlun/rms_norm_kernel.xpu
+0
-10
No files found.
src/infiniop/devices/kunlun/kunlun_common.h
View file @
0fdaa522
...
...
@@ -13,4 +13,14 @@ static inline __device__ float lowerBitMask(int i) {
return
(
1
<<
(
i
+
1
))
-
1
;
}
#endif
\ No newline at end of file
// Atomic add for reduce
static
inline
__device__
void
atomic_add
(
__shared_ptr__
float
*
ptr
,
float
value
)
{
int
fail
=
1
;
while
(
fail
)
{
float
a
=
SM2REG_atomic
(
ptr
);
a
=
a
+
value
;
fail
=
REG2SM_atomic
(
ptr
,
a
);
}
}
#endif
src/infiniop/ops/rms_norm/kunlun/rms_norm_kernel.xpu
View file @
0fdaa522
...
...
@@ -26,16 +26,6 @@ static inline __device__ void elementMul(float *x, float *w, float *y, int count
}
}
// Atomic add for reduce
static inline __device__ void atomic_add(__shared_ptr__ float *ptr, float value) {
int fail = 1;
while (fail) {
float a = SM2REG_atomic(ptr);
a = a + value;
fail = REG2SM_atomic(ptr, a);
}
}
// RmsNorm main kernel func
// kunlun2 has 8 cluster and 64 core
// Call it by rmsnorm<<<8, 32, stream>>>()
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment