Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
OpenDAS
vllm_cscc
Commits
bbc6c2f1
Unverified
Commit
bbc6c2f1
authored
Nov 19, 2025
by
j20120307
Committed by
GitHub
Nov 19, 2025
Browse files
[CI/Build] Fix broken build on Apple M1 (#28999)
Signed-off-by:
Kan Zhu
<
j20120307@gmail.com
>
parent
81516095
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
18 additions
and
0 deletions
+18
-0
csrc/cpu/utils.hpp
csrc/cpu/utils.hpp
+18
-0
No files found.
csrc/cpu/utils.hpp
View file @
bbc6c2f1
...
...
@@ -6,6 +6,10 @@
#include <cstdint>
#include <unistd.h>
#if defined(__APPLE__)
#include <sys/sysctl.h>
#endif
#include "cpu_types.hpp"
namespace
cpu_utils
{
...
...
@@ -21,10 +25,12 @@ struct VecTypeTrait<float> {
using
vec_t
=
vec_op
::
FP32Vec16
;
};
#if !defined(__aarch64__) || defined(ARM_BF16_SUPPORT)
template
<
>
struct
VecTypeTrait
<
c10
::
BFloat16
>
{
using
vec_t
=
vec_op
::
BF16Vec16
;
};
#endif
template
<
>
struct
VecTypeTrait
<
c10
::
Half
>
{
...
...
@@ -44,9 +50,21 @@ struct Counter {
inline
int64_t
get_l2_size
()
{
static
int64_t
size
=
[]()
{
#if defined(__APPLE__)
// macOS doesn't have _SC_LEVEL2_CACHE_SIZE. Use sysctlbyname.
int64_t
l2_cache_size
=
0
;
size_t
len
=
sizeof
(
l2_cache_size
);
if
(
sysctlbyname
(
"hw.l2cachesize"
,
&
l2_cache_size
,
&
len
,
NULL
,
0
)
==
0
&&
l2_cache_size
>
0
)
{
return
l2_cache_size
>>
1
;
// use 50% of L2 cache
}
// Fallback if sysctlbyname fails
return
128LL
*
1024
>>
1
;
// use 50% of 128KB
#else
long
l2_cache_size
=
sysconf
(
_SC_LEVEL2_CACHE_SIZE
);
assert
(
l2_cache_size
!=
-
1
);
return
l2_cache_size
>>
1
;
// use 50% of L2 cache
#endif
}();
return
size
;
}
...
...
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