Skip to content

Commit 575b146

Browse files
committed
fix build failure on msvc
1 parent 7530491 commit 575b146

File tree

3 files changed

+8
-5
lines changed

3 files changed

+8
-5
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_) {

pyproject.toml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,8 @@ dependencies = [
3030
"build",
3131
"fire",
3232
"protobuf",
33-
"triton >= 3.2"
33+
"triton >= 3.2; sys_platform != 'win32' and sys_platform != 'Windows'",
34+
"triton-windows >= 3.2; sys_platform == 'win32' or sys_platform == 'Windows'"
3435
]
3536

3637
requires-python = ">=3.10"

requirements-local_chat.txt

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,4 +7,5 @@ cpufeature; sys_platform == 'win32' or sys_platform == 'Windows'
77
protobuf
88
tiktoken
99
blobfile
10-
triton>=3.2
10+
triton>=3.2; sys_platform != 'win32' and sys_platform != 'Windows'
11+
triton-windows>=3.2; sys_platform == 'win32' or sys_platform == 'Windows'

0 commit comments

Comments
 (0)