Skip to content

Commit f14bc30

Browse files
committed
fix build failure on msvc
1 parent 32f3d7b commit f14bc30

File tree

2 files changed

+8
-4
lines changed

2 files changed

+8
-4
lines changed

csrc/ktransformers_ext/cpu_backend/shared_mem_buffer.cpp

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@
99
**/
1010
#include "shared_mem_buffer.h"
1111
#include <cstdio>
12+
#include <new>
1213

1314
SharedMemBuffer::SharedMemBuffer() {
1415
buffer_ = nullptr;
@@ -17,7 +18,7 @@ SharedMemBuffer::SharedMemBuffer() {
1718

1819
SharedMemBuffer::~SharedMemBuffer() {
1920
if (buffer_) {
20-
free(buffer_);
21+
::operator delete(buffer_, std::align_val_t(64));
2122
}
2223
}
2324

@@ -28,9 +29,9 @@ void SharedMemBuffer::alloc(void* object, std::vector<std::pair<void**, uint64_t
2829
}
2930
if (size > size_) {
3031
if (buffer_) {
31-
free(buffer_);
32+
::operator delete(buffer_, std::align_val_t(64));
3233
}
33-
buffer_ = std::aligned_alloc(64, size);
34+
buffer_ = ::operator new(size, std::align_val_t(64));
3435

3536
size_ = size;
3637
for (auto& obj_requests : hist_requests_) {

setup.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,10 @@
4848
"pytorch-triton-xpu==3.3.0"
4949
]
5050
else:
51-
triton_dep = ["triton>=3.2"]
51+
triton_dep = [
52+
"triton >= 3.2; sys_platform != 'win32' and sys_platform != 'Windows'",
53+
"triton-windows >= 3.2; sys_platform == 'win32' or sys_platform == 'Windows'"
54+
]
5255

5356
with_balance = os.environ.get("USE_BALANCE_SERVE", "0") == "1"
5457

0 commit comments

Comments
 (0)