Skip to content

Commit

Permalink
update
Browse files Browse the repository at this point in the history
  • Loading branch information
jim19930609 committed Mar 14, 2023
1 parent c331da2 commit 92509db
Show file tree
Hide file tree
Showing 4 changed files with 8 additions and 1 deletion.
1 change: 1 addition & 0 deletions taichi/inc/constants.h
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

#include <cstddef>

constexpr int taichi_min_bytes_to_allocate = 1;
constexpr int taichi_max_num_indices = 12;
// legacy: only used in cc and opengl backends
constexpr int taichi_max_num_args = 8;
Expand Down
2 changes: 2 additions & 0 deletions taichi/rhi/cpu/cpu_device.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,8 @@ CpuDevice::AllocInfo CpuDevice::get_alloc_info(const DeviceAllocation handle) {

RhiResult CpuDevice::allocate_memory(const AllocParams &params,
DeviceAllocation *out_devalloc) {
TI_ASSERT(params.size > 0);

AllocInfo info;

auto vm = std::make_unique<VirtualMemoryAllocator>(params.size);
Expand Down
3 changes: 2 additions & 1 deletion taichi/runtime/llvm/llvm_runtime_executor.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -394,7 +394,8 @@ void LlvmRuntimeExecutor::initialize_llvm_runtime_snodes(
const int root_id = field_cache_data.root_id;

TI_TRACE("Allocating data structure of size {} bytes", root_size);
std::size_t rounded_size = taichi::iroundup(root_size, taichi_page_size);
size_t allocate_size = root_size + taichi_min_bytes_to_allocate;
std::size_t rounded_size = taichi::iroundup(allocate_size, taichi_page_size);

DeviceAllocation alloc = snode_tree_buffer_manager_->allocate(
rounded_size, tree_id, result_buffer);
Expand Down
3 changes: 3 additions & 0 deletions taichi/runtime/llvm/snode_tree_buffer_manager.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,11 @@ SNodeTreeBufferManager::SNodeTreeBufferManager(
DeviceAllocation SNodeTreeBufferManager::allocate(std::size_t size,
const int snode_tree_id,
uint64 *result_buffer) {
std::cout << 1111 << std::endl;
std::cout << size << std::endl;
DeviceAllocation devalloc =
runtime_exec_->allocate_memory_ndarray(size, result_buffer);
std::cout << 2222 << std::endl;
roots_[snode_tree_id] = devalloc;
sizes_[snode_tree_id] = size;

Expand Down

0 comments on commit 92509db

Please sign in to comment.