Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Lang] Remove deprecated compile option ndarray_use_cached_allocator #7937

Merged
merged 1 commit into from
May 8, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 3 additions & 4 deletions c_api/src/taichi_llvm_impl.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -52,14 +52,13 @@ taichi::lang::Device &LlvmRuntime::get() {

TiMemory LlvmRuntime::allocate_memory(
const taichi::lang::Device::AllocParams &params) {
const taichi::lang::CompileConfig &config = executor_->get_config();
taichi::lang::LLVMRuntime *llvm_runtime = executor_->get_llvm_runtime();
taichi::lang::LlvmDevice *llvm_device = executor_->llvm_device();

taichi::lang::DeviceAllocation devalloc =
llvm_device->allocate_memory_runtime(
{params, config.ndarray_use_cached_allocator,
executor_->get_runtime_jit_module(), llvm_runtime, result_buffer});
llvm_device->allocate_memory_runtime({params,
executor_->get_runtime_jit_module(),
llvm_runtime, result_buffer});
return devalloc2devmem(*this, devalloc);
}

Expand Down
1 change: 0 additions & 1 deletion taichi/program/compile_config.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,6 @@ CompileConfig::CompileConfig() {
make_thread_local = true;
make_block_local = true;
detect_read_only = true;
ndarray_use_cached_allocator = true;
real_matrix_scalarize = true;
half2_vectorization = false;
make_cpu_multithreading_loop = true;
Expand Down
1 change: 0 additions & 1 deletion taichi/program/compile_config.h
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,6 @@ struct CompileConfig {
bool make_thread_local;
bool make_block_local;
bool detect_read_only;
bool ndarray_use_cached_allocator;
bool real_matrix_scalarize;
bool half2_vectorization;
bool make_cpu_multithreading_loop;
Expand Down
2 changes: 0 additions & 2 deletions taichi/python/export_lang.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -193,8 +193,6 @@ void export_lang(py::module &m) {
.def_readwrite("make_thread_local", &CompileConfig::make_thread_local)
.def_readwrite("make_block_local", &CompileConfig::make_block_local)
.def_readwrite("detect_read_only", &CompileConfig::detect_read_only)
.def_readwrite("ndarray_use_cached_allocator",
&CompileConfig::ndarray_use_cached_allocator)
.def_readwrite("real_matrix_scalarize",
&CompileConfig::real_matrix_scalarize)
.def_readwrite("half2_vectorization", &CompileConfig::half2_vectorization)
Expand Down
6 changes: 2 additions & 4 deletions taichi/rhi/amdgpu/amdgpu_device.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -56,17 +56,15 @@ DeviceAllocation AmdgpuDevice::allocate_memory_runtime(
info.size = taichi::iroundup(params.size, taichi_page_size);
if (params.host_read || params.host_write) {
TI_NOT_IMPLEMENTED
} else if (params.use_cached) {
} else {
info.ptr =
DeviceMemoryPool::get_instance().allocate_with_cache(this, params);
TI_ASSERT(info.ptr != nullptr);

AMDGPUDriver::get_instance().memset((void *)info.ptr, 0, info.size);
} else {
info.ptr = allocate_llvm_runtime_memory_jit(params);
}
info.is_imported = false;
info.use_cached = params.use_cached;
info.use_cached = true;
ailzhang marked this conversation as resolved.
Show resolved Hide resolved
info.use_preallocated = true;

DeviceAllocation alloc;
Expand Down
6 changes: 2 additions & 4 deletions taichi/rhi/cuda/cuda_device.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -51,18 +51,16 @@ DeviceAllocation CudaDevice::allocate_memory_runtime(
info.size = taichi::iroundup(params.size, taichi_page_size);
if (info.size == 0) {
info.ptr = nullptr;
} else if (params.use_cached) {
} else {
info.ptr =
DeviceMemoryPool::get_instance().allocate_with_cache(this, params);

TI_ASSERT(info.ptr != nullptr);

CUDADriver::get_instance().memset((void *)info.ptr, 0, info.size);
} else {
info.ptr = allocate_llvm_runtime_memory_jit(params);
}
info.is_imported = false;
info.use_cached = params.use_cached;
info.use_cached = true;
info.use_preallocated = true;

DeviceAllocation alloc;
Expand Down
1 change: 0 additions & 1 deletion taichi/rhi/llvm/llvm_device.h
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@ struct LLVMRuntime;
class LlvmDevice : public Device {
public:
struct LlvmRuntimeAllocParams : AllocParams {
bool use_cached{true};
JITModule *runtime_jit{nullptr};
LLVMRuntime *runtime{nullptr};
uint64 *result_buffer{nullptr};
Expand Down
1 change: 0 additions & 1 deletion taichi/runtime/llvm/llvm_runtime_executor.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -475,7 +475,6 @@ DeviceAllocation LlvmRuntimeExecutor::allocate_memory_ndarray(
return llvm_device()->allocate_memory_runtime(
{{alloc_size, /*host_write=*/false, /*host_read=*/false,
/*export_sharing=*/false, AllocUsage::Storage},
config_.ndarray_use_cached_allocator,
get_runtime_jit_module(),
get_llvm_runtime(),
result_buffer});
Expand Down
2 changes: 1 addition & 1 deletion tests/python/test_ndarray.py
Original file line number Diff line number Diff line change
Expand Up @@ -278,7 +278,7 @@ def test_ndarray_deepcopy():
assert y[4][1, 0] == 9


@test_utils.test(arch=[ti.cuda], ndarray_use_cached_allocator=True)
@test_utils.test(arch=[ti.cuda])
def test_ndarray_caching_allocator():
n = 8
a = ti.ndarray(ti.i32, shape=(n))
Expand Down