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

Refactor kernel compilation #7002

Closed
35 of 36 tasks
PGZXB opened this issue Dec 28, 2022 · 0 comments
Closed
35 of 36 tasks

Refactor kernel compilation #7002

PGZXB opened this issue Dec 28, 2022 · 0 comments
Assignees
Labels
refactor Refactor of API or codebases

Comments

@PGZXB
Copy link
Contributor

PGZXB commented Dec 28, 2022

(This is part of Refactor kernel compilation and launch, which aims to split kernel compilation and kernel launching totally.)

Brief Introduction

  1. Isolate the stuff which is not related with kernel compilation from lang::Kernel.
  2. lang::CompileConfig per compilation instead of lang::CompileConfig per lang::Program.
  3. Introduce lang::CompiledKernelData, lang::KernelCompiler to unify the compilation result and the interfaces of kernel compilation.
  4. Introduce lang::KernelCompilationManager to unify the implementation of cache on ALL backends, including online cache and offline cache
  5. Re-impl the JIT in Python frontend and remove the online cache in frontend

Prototype

Provide @ti.pkernel

NOTE: The @ti.pkernel is only an attempt based on the prototype in order to verify the effect of the proposal, which is NOT a "feature request".

  • @ti.pkernel = @ti.kernel + CompileConfig, which allows the user to specify different compile configuration options for each kernel.

Implementation

Example

import taichi as ti

ti.init(arch=ti.vulkan, offline_cache=True, print_preprocessed_ir=False)

@ti.kernel
def K1(a: ti.i32, b: ti.i32) -> ti.i32:
  return a + b


@ti.pkernel(offline_cache=False, print_preprocessed_ir=True)
def PK1(a: ti.i32, b: ti.i32) -> ti.i32:
  return a * b

# Not allowed before finishing "Refactor kernel launch"
# @ti.pkernel(arch=ti.cpu) # ti.cpu != ti.vulkan
# def PK2(a: ti.i32, b: ti.i32) -> ti.i32:
#   return a * b

K1(10, 10)
PK1(10, 10)
# PK2(10, 100)

To-Do List

  • Remove dependencies on Program::current_ast_builder() in C++ side, see prototype: 73e5b71
  • Remove Program::current_ast_builder(), see prototype: 0b30140
  • Remove Program::current_callable, see prototype: f6d5a55; fdd230f
  • Remove Kernel::arch
  • Remove Kernel::lower & Add irpass::ast_to_ir, see prototype: 6a83c69; a77e46a
  • Remove CompileConfig::lazy_compilation, see prototype: b82cd7d
  • Move Kernel::compile and Kernel::operator() outside, see prototype: b5d6beb
  • Rename arg to param in class Callable, see prototype: b943d3d
  • Refactor Kernel::get_ret*, see prototype: d87a8ba; 80bea89; 732b4a3; 0920501; 0f2a0b5; 7eb13d5
  • Remove dependencies on Program::this_thread_config() in metal::CacheManager, see prototype: e595513
  • Remove offloaded parameter of Program*::compile, see prototype: 582f287
  • Remove ir parameter in KernelCodeGen::KernelCodeGen(Kernel *kernel, IRNode *ir), see prototype: a2f1e15
  • Remove dependencies on Program::this_thread_config() in KernelCodeGen, see prototype: 187f206
  • Remove dependencies on Program::this_thread_config() in codgen on llvm backends, see prototype: 423a29c; 8ecf111; b8deaf0
  • Remove dependencies on Program::this_thread_config() in irpass::scalarize, see prototype: 40d4b33
  • Remove dependencies on Program::this_thread_config() in gfx/runtime.cpp, see prototype: 2120e43; 53d9e8e
  • Remove dependencies on Program::this_thread_config() in spirv::lower, see prototype: 79b4b9a
  • Remove dependencies on Program::this_thread_config() in codegen_cc.cpp, see prototype: 19d6e11
  • Remove IRNode::get_config, IRNode::get_kernel and IRNode::kernel, see prototype: 592f798; 72b23df
  • Remove dependencies on Program::this_thread_config() in lang::launch_kernel(), see prototype: 1f958a3; f9de0fe
  • Remove dependencies on Program::this_thread_config() in constant folding & rm possible race condition, see prototype: 2571bf9; 3164640
  • Remove Program::this_thread_config() & Add Program::global_compile_compileconfig(), see prototype: abcff07
  • Split lang::Function, see prototype: d87e6d9
  • Implement irpass::clone for AST
  • Introduce CompiledKernelData & KernelCompiler & KernelCompilationManager, impl them for spirv/gfx backends and re-impl VulkanProgramImpl::compile() and gfx::AotModuleBuilder, see prototype: 40e9751; c8e6285; 0697032
  • compile - runtime split for TaichiLLVMContext #7311
  • Intorduce CompiledKernelData & KernelCompiler for LLVM backends (Hard)
  • Intorduce CompiledKernelData & KernelCompiler for Metal backends
  • Fix implementation of JIT in Python-frontend: t_kernel(ctx) -> load_or_compile(...) && prog.launch_kernel(...)
  • Remove online cache in Python side (PyTaichi.compiled_functions)
  • Redesign the algorithm to generate the offline cache key for real_funcs (to fix The offline cache doesn't work properly on the program that contains indirect recursive calls to real functions #6877)
  • Remove lang::Callable::program #7286
  • Fix all const CompileConfig * to const CompileConfig &`
  • Remove Kernel::from_cache_
  • Remove Kernel::task_counter_
  • Remove useless Kernel::lowered_

Related work

  • Maybe start replacing pybind11 with XXXXXX from the APIs about kernel compilation and launch. Some of them will be refactored and standardized in this proposal.
@github-project-automation github-project-automation bot moved this to Untriaged in Taichi Lang Dec 28, 2022
@PGZXB PGZXB self-assigned this Dec 28, 2022
@PGZXB PGZXB added the refactor Refactor of API or codebases label Dec 28, 2022
@feisuzhu feisuzhu moved this from Untriaged to In Progress in Taichi Lang Dec 30, 2022
PGZXB added a commit to PGZXB/taichi that referenced this issue Jan 5, 2023
PGZXB added a commit that referenced this issue Jan 5, 2023
PGZXB added a commit that referenced this issue Jan 5, 2023
PGZXB added a commit that referenced this issue Jan 9, 2023
PGZXB added a commit that referenced this issue Jan 9, 2023
Issue: #7002

Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
PGZXB added a commit that referenced this issue Jan 11, 2023
PGZXB added a commit that referenced this issue Jan 11, 2023
quadpixels pushed a commit to quadpixels/taichi that referenced this issue May 13, 2023
…vm backends codegen (taichi-dev#7153)

Issue: taichi-dev#7002

Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
quadpixels pushed a commit to quadpixels/taichi that referenced this issue May 13, 2023
quadpixels pushed a commit to quadpixels/taichi that referenced this issue May 13, 2023
…pass::constant_fold (taichi-dev#7159)

Issue: taichi-dev#7002 

### Brief Summary
1. The dependencies on `Program::this_thread_config()` in
`irpass::constant_fold` were removed;
2. The race condition of `Program::config` (concurrent write) was
killed, so we can remove the multi-thread version
`Program::this_thread_config()`. I will do it in next PR;
3. The `Program::compile(Kernel *kernel)` was refactored to
`Program::compile(const CompileConfig &compile_config, Kernel *kernel)`,
which is a temporary solution because I will introduce new classes to
provide compilation interfaces (see taichi-dev#7002 for more information).

Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
quadpixels pushed a commit to quadpixels/taichi that referenced this issue May 13, 2023
…taichi-dev#7199)

Issue: taichi-dev#7002 
Removed multi-thread version `Program::this_thread_config()` (see
taichi-dev#7159 (comment))

Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
quadpixels pushed a commit to quadpixels/taichi that referenced this issue May 13, 2023
…hi-dev#7209)

Issue: taichi-dev#7002 

### Brief Summary
Removed dependencies on `Program::this_thread_config()` in
`lang::Function` compilation (AST->IR part)
* Push off the compilation of `lang::Function`: Introduce the
`irpass::compile_called_function(IRNode *root, const CompileConfig
&config)`, which compiles the AST/IR of `Function`s called in `root` to
the final IR.
quadpixels pushed a commit to quadpixels/taichi that referenced this issue May 13, 2023
quadpixels pushed a commit to quadpixels/taichi that referenced this issue May 13, 2023
…ichi-dev#7243)

Issue: taichi-dev#7002,
taichi-dev#7159 (comment)

---------

Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
quadpixels pushed a commit to quadpixels/taichi that referenced this issue May 13, 2023
…rt2) (taichi-dev#7253)

Issue: taichi-dev#7002

---------

Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
quadpixels pushed a commit to quadpixels/taichi that referenced this issue May 13, 2023
…ed_offline_cache_key (taichi-dev#7287)

Issue: taichi-dev#7286
* taichi-dev#7286: Part of taichi-dev#7002

---------

Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
quadpixels pushed a commit to quadpixels/taichi that referenced this issue May 13, 2023
… in KernelCodeGen (taichi-dev#7289)

Issue: taichi-dev#7286
* This PR: Part of removing `KernelCodeGen::prog`
* removing `KernelCodeGen::prog`: Part of taichi-dev#7286 
* taichi-dev#7286: Part of taichi-dev#7002

---------

Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
quadpixels pushed a commit to quadpixels/taichi that referenced this issue May 13, 2023
…Graph::run (taichi-dev#7288)

Issue: taichi-dev#7286
* taichi-dev#7286: Part of
taichi-dev#7002

---------

Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
quadpixels pushed a commit to quadpixels/taichi that referenced this issue May 13, 2023
quadpixels pushed a commit to quadpixels/taichi that referenced this issue May 13, 2023
…#7391)

Issue: taichi-dev#7002 

### Brief Summary
Disable `ASTSerializer::allow_undefined_visitor`:
1. Enabling `ASTSerializer::allow_undefined_visitor` is dangerous;
2. Prepare for introducing `KernelCompilationManager`.
quadpixels pushed a commit to quadpixels/taichi that referenced this issue May 13, 2023
…er (taichi-dev#7371)

Issue: taichi-dev#7002 

### Brief Summary
* Impl `spirv::CompilerKernelData`
* Introduce `lang::KernelCompiler` & Impl `spirv::KernelCompiler`

p.s. The `KernelCompiler` is not used now. Next PR, I will introduce
`KernelCompilatonManager`, which depends on the `CompilerKernelData` and
`KernelCompiler`

---------

Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
quadpixels pushed a commit to quadpixels/taichi that referenced this issue May 13, 2023
Issue: taichi-dev#7002, taichi-dev#4401

### Brief Summary
This PR:
1. Introduced `KernelCompilationManager` to unify implementation of the
Offline Cache;
2. Used `KernelCompilationManager` re-impl JIT, Offline Cache on gfx
backends (vulkan, metal, dx11, opengl);
3. Removed the `gfx::CacheManager`.

---------

Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
quadpixels pushed a commit to quadpixels/taichi that referenced this issue May 13, 2023
Issue: taichi-dev#7002 

### Brief Summary
The member was used by old implementation of offline cache, which is
unnecessary now.
quadpixels pushed a commit to quadpixels/taichi that referenced this issue May 13, 2023
quadpixels pushed a commit to quadpixels/taichi that referenced this issue May 13, 2023
…chi-dev#7425)

Issue: taichi-dev#7002

### Brief Summary
The functions were used by old implementation of offline cache, which
are unnecessary now.
quadpixels pushed a commit to quadpixels/taichi that referenced this issue May 13, 2023
Issue: taichi-dev#7002 

### Brief Summary
#### Fixed bug reported by
https://github.com/taichi-dev/taichi/actions/runs/4346468687/jobs/7592576659
:
```
Error in atexit._run_exitfuncs:
Traceback (most recent call last):
  File "tests/run_tests.py", line 233, in print_and_remove
    os.listdir(os.path.join(tmp_cache_file_path, subdir)))
NotADirectoryError: [Errno 20] Not a directory: '/var/folders/1r/fk_r0s1d4ss8m19rg11bq1j80000gp/T/tmpcnyh7mz1/Tbdbfefe5b5fe6db167e250d15bb1c4cc797b2beee4fa7a09be9a6cff8c060101-metal.tic'
```
#### Quick repro on master:
`python run_tests.py -v -t4 -a vulkan,cpu abs --with-offline-cache`
```
...
Error in atexit._run_exitfuncs:
Traceback (most recent call last):
  File "..\taichi\tests\run_tests.py", line 233, in print_and_remove
    os.listdir(os.path.join(tmp_cache_file_path, subdir)))
NotADirectoryError: [WinError 267] The directory name is invalid. : 'C:\\Users\\xxx\\AppData\\Local\\Temp\\tmpcs7z9cpq\\T1571a996babd2f9b7a24eeba9d8450fd767cf939b8d717941f629550302d6408-vulkan.tic'
```
#### On this branch (fixed the bug):
`python run_tests.py -v -t4 -a vulkan,cpu abs --with-offline-cache`
```
...
Summary of testing the offline cache:
    Simple statistics: {'llvm': 19, '*.tic': 18}
    Size of cache files: 646.04 KB
```
quadpixels pushed a commit to quadpixels/taichi that referenced this issue May 13, 2023
…() (taichi-dev#7540)

Issue: taichi-dev#7002 

### Brief Summary
It is challenging to implement the function
`CompiledKernelData::size()`, particularly for the
`llvm::CompiledKernelData` class, as it is not possible to obtain the
size of the `llvm::Module` without dumping it.
quadpixels pushed a commit to quadpixels/taichi that referenced this issue May 13, 2023
…LlvmAotModuleBuilder (taichi-dev#7714)

Issue: taichi-dev#7002 

### Brief Summary

---------

Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
quadpixels pushed a commit to quadpixels/taichi that referenced this issue May 13, 2023
Issue: taichi-dev#7002 

### Brief Summary

<!--
copilot:summary
-->
### <samp>🤖 Generated by Copilot at f2ee059</samp>

Improve kernel compilation manager efficiency by avoiding redundant
cache loading.
### Walkthrough

<!--
copilot:walkthrough
-->
### <samp>🤖 Generated by Copilot at f2ee059</samp>

* Add a check for existing kernel data to avoid redundant loading
([link](https://github.com/taichi-dev/taichi/pull/7741/files?diff=unified&w=0#diff-b7662dbf5bcf20f4b99048f4f2405316c0ba037c0722273522efaad72d256ef0L219-R228))
quadpixels pushed a commit to quadpixels/taichi that referenced this issue May 13, 2023
Issue: taichi-dev#7002 

### Brief Summary

<!--
copilot:summary
-->
### <samp>🤖 Generated by Copilot at 8d2c768</samp>

This pull request improves the error handling and debugging of the
kernel compilation and caching process using the LLVM backend. It adds a
`check` function to the `CompiledKernelData` class that verifies the
LLVM module and tasks, and uses it to assert and report the status of
the data.

### Walkthrough

<!--
copilot:walkthrough
-->
### <samp>🤖 Generated by Copilot at 8d2c768</samp>

* Add a new error enum value and message for the case when the
CompiledKernelData is broken
([link](https://github.com/taichi-dev/taichi/pull/7743/files?diff=unified&w=0#diff-5e2472488f9620231c8e3d6a2c0413742e2b42424691991f4a85af81832af3f4R95),
[link](https://github.com/taichi-dev/taichi/pull/7743/files?diff=unified&w=0#diff-70ec30330946b7543dcf0b458091cfc6128a5cb5460041db64144b84722de4abR184-R185))
* Implement a check function for the CompiledKernelData class that
verifies the LLVM module and the tasks stored in the data using the LLVM
verifier
([link](https://github.com/taichi-dev/taichi/pull/7743/files?diff=unified&w=0#diff-3986d4b2137cab0463bb950113c0ddc44cfdf3baff237da6286c42c478309c3bR3),
[link](https://github.com/taichi-dev/taichi/pull/7743/files?diff=unified&w=0#diff-3986d4b2137cab0463bb950113c0ddc44cfdf3baff237da6286c42c478309c3bR30-R43),
[link](https://github.com/taichi-dev/taichi/pull/7743/files?diff=unified&w=0#diff-e54a1ed2c2d35f9357e4dfbbbc1224e70a95280b43d4a59f0017dc2c6163dca0R55-R56))
* Add assertions and checks for the result of the check function after
compiling or loading a kernel using the LLVM backend, and modify the
debug message to include the cache filename
([link](https://github.com/taichi-dev/taichi/pull/7743/files?diff=unified&w=0#diff-b7662dbf5bcf20f4b99048f4f2405316c0ba037c0722273522efaad72d256ef0R178),
[link](https://github.com/taichi-dev/taichi/pull/7743/files?diff=unified&w=0#diff-b7662dbf5bcf20f4b99048f4f2405316c0ba037c0722273522efaad72d256ef0L266-R275))
quadpixels pushed a commit to quadpixels/taichi that referenced this issue May 13, 2023
quadpixels pushed a commit to quadpixels/taichi that referenced this issue May 13, 2023
Issue: taichi-dev#7002

### Brief Summary

<!--
copilot:summary
-->
### <samp>🤖 Generated by Copilot at 618302d</samp>

This pull request introduces a mechanism to assign unique ids to each
offloaded task in different backends, enabling asynchronous execution of
kernels on various devices. It modifies the constructors and methods of
several codegen classes to accept and pass task ids, and simplifies the
task id generation for kernels by using local counters. It mainly
affects the files `taichi/codegen/*` and `taichi/program/kernel.h`.

### Walkthrough

<!--
copilot:walkthrough
-->
### <samp>🤖 Generated by Copilot at 618302d</samp>

* Add an `id` parameter to the constructors of `TaskCodeGenLLVM` and its
subclasses (`TaskCodeGenAMDGPU`, `TaskCodeGenCPU`, `TaskCodeGenCUDA`,
`TaskCodeGenLLVMDX12`) to pass a unique identifier for each task codegen
instance
([link](https://github.com/taichi-dev/taichi/pull/7751/files?diff=unified&w=0#diff-f45ad00d5bebbc900cf84ab5b4f0b634fe8ca7a99770788c2cb5b055612c1e85L30-R35),
[link](https://github.com/taichi-dev/taichi/pull/7751/files?diff=unified&w=0#diff-b6e86fbdf536db46b321f67942f66d809c213a4142ceb9f5f81d016684c2d5c8L30-R35),
[link](https://github.com/taichi-dev/taichi/pull/7751/files?diff=unified&w=0#diff-50537ad5ea3b900c0d55a088f3cc285986340ad68c9b96fea481187c4dce49eaL44-R49),
[link](https://github.com/taichi-dev/taichi/pull/7751/files?diff=unified&w=0#diff-b26bcd66b9334fe882df039d1c619f16f0f91f6c43c3872b6cbb2688b8e7b749L24-R29),
[link](https://github.com/taichi-dev/taichi/pull/7751/files?diff=unified&w=0#diff-3c663c78745adcd3f6a7ac81fe99e628decc3040f292ea1e20ecd4b85a7f4313L306-R307),
[link](https://github.com/taichi-dev/taichi/pull/7751/files?diff=unified&w=0#diff-aebc3d71bb555fba77f1d303d5c29ac7e07d392440b0e54cf556ff5a10a81d0aL73-R78))
* Add an `task_codegen_id` parameter to the `compile_task` methods of
`KernelCodeGen` and its subclasses (`KernelCodeGenAMDGPU`,
`KernelCodeGenCPU`, `KernelCodeGenCUDA`, `KernelCodeGenDX12`) to pass
the task codegen id to the task codegen constructors
([link](https://github.com/taichi-dev/taichi/pull/7751/files?diff=unified&w=0#diff-f45ad00d5bebbc900cf84ab5b4f0b634fe8ca7a99770788c2cb5b055612c1e85L486-R492),
[link](https://github.com/taichi-dev/taichi/pull/7751/files?diff=unified&w=0#diff-2dca4a15a3c5e43017b458e9a19d8edabade6e4489c719aea88819e9dc34c285R22),
[link](https://github.com/taichi-dev/taichi/pull/7751/files?diff=unified&w=0#diff-54b0d16247300543741692be7cec4b05993efa661e71ad3d69d5da85fcbc7782L91-R91),
[link](https://github.com/taichi-dev/taichi/pull/7751/files?diff=unified&w=0#diff-75d426482e598b420f6f3bed213844bbfcca397be6d3a3371c9ff8128275a6fdR63),
[link](https://github.com/taichi-dev/taichi/pull/7751/files?diff=unified&w=0#diff-b6e86fbdf536db46b321f67942f66d809c213a4142ceb9f5f81d016684c2d5c8L288-R293),
[link](https://github.com/taichi-dev/taichi/pull/7751/files?diff=unified&w=0#diff-9bc17077ecc24636db6f9c92d14d55bdcdb87c18379d72a06a9e84486d20b060R24),
[link](https://github.com/taichi-dev/taichi/pull/7751/files?diff=unified&w=0#diff-50537ad5ea3b900c0d55a088f3cc285986340ad68c9b96fea481187c4dce49eaL743-R749),
[link](https://github.com/taichi-dev/taichi/pull/7751/files?diff=unified&w=0#diff-15ab2a7729595aeafa4c5a77a6c97e9a7e9d43ffd49210b86d940b6394e58475R22),
[link](https://github.com/taichi-dev/taichi/pull/7751/files?diff=unified&w=0#diff-b26bcd66b9334fe882df039d1c619f16f0f91f6c43c3872b6cbb2688b8e7b749L246-R247),
[link](https://github.com/taichi-dev/taichi/pull/7751/files?diff=unified&w=0#diff-b26bcd66b9334fe882df039d1c619f16f0f91f6c43c3872b6cbb2688b8e7b749L263-R269),
[link](https://github.com/taichi-dev/taichi/pull/7751/files?diff=unified&w=0#diff-d4ff49adc577edb7d11d8e69b2fb1e97162aaf01ef896e588a35cc8a20e061b1R29))
* Use the `task_codegen_id` and a local `task_counter` to generate
unique task ids for each offloaded statement in the
`init_offloaded_task_function` method of `TaskCodeGenLLVM`, instead of
using a shared atomic counter in the `Kernel` class
([link](https://github.com/taichi-dev/taichi/pull/7751/files?diff=unified&w=0#diff-3c663c78745adcd3f6a7ac81fe99e628decc3040f292ea1e20ecd4b85a7f4313L1956-R1958),
[link](https://github.com/taichi-dev/taichi/pull/7751/files?diff=unified&w=0#diff-3c663c78745adcd3f6a7ac81fe99e628decc3040f292ea1e20ecd4b85a7f4313R316),
[link](https://github.com/taichi-dev/taichi/pull/7751/files?diff=unified&w=0#diff-aebc3d71bb555fba77f1d303d5c29ac7e07d392440b0e54cf556ff5a10a81d0aR66-R69),
[link](https://github.com/taichi-dev/taichi/pull/7751/files?diff=unified&w=0#diff-5831927e99f989a5c80bace0ae3a103f99fb5849cf6e591a22a8bb83d3a14c3fL68-L71),
[link](https://github.com/taichi-dev/taichi/pull/7751/files?diff=unified&w=0#diff-5831927e99f989a5c80bace0ae3a103f99fb5849cf6e591a22a8bb83d3a14c3fL95-R91))

---------

Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
quadpixels pushed a commit to quadpixels/taichi that referenced this issue May 13, 2023
Issue: taichi-dev#7002

### Brief Summary

`Program::compile()` => `Program::compile_kernel()` +
`Program::launch_kernel()`
quadpixels pushed a commit to quadpixels/taichi that referenced this issue May 13, 2023
Issue: taichi-dev#7002 

### Brief Summary

<!--
copilot:summary
-->
### <samp>🤖 Generated by Copilot at 5923f65</samp>

Refactor compiled function management for kernels in `PyTaichi`. Use
`compiled_kernels` attribute of each kernel instead of
`compiled_functions` attribute of `PyTaichi`.

### Walkthrough

<!--
copilot:walkthrough
-->
### <samp>🤖 Generated by Copilot at 5923f65</samp>

* Remove the `compiled_functions` attribute from the `PyTaichi` class
and use the `compiled_kernels` attribute of each kernel instead
([link](https://github.com/taichi-dev/taichi/pull/7867/files?diff=unified&w=0#diff-99744c5ae5f6a754d6f68408fdc64fb0d6097216518a7f3d1ef43ffe12599577L316))
* Update the `clear_compiled_functions` method of the `PyTaichi` class
to clear the `compiled_kernels` attribute of each kernel
([link](https://github.com/taichi-dev/taichi/pull/7867/files?diff=unified&w=0#diff-99744c5ae5f6a754d6f68408fdc64fb0d6097216518a7f3d1ef43ffe12599577L339-R339))
* Update the `get_num_compiled_functions` method of the `PyTaichi` class
to sum up the lengths of the `compiled_kernels` attribute of each kernel
([link](https://github.com/taichi-dev/taichi/pull/7867/files?diff=unified&w=0#diff-99744c5ae5f6a754d6f68408fdc64fb0d6097216518a7f3d1ef43ffe12599577L354-R357))

---------

Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
@PGZXB PGZXB closed this as completed Sep 14, 2023
@github-project-automation github-project-automation bot moved this from In Progress to Done in Taichi Lang Sep 14, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
refactor Refactor of API or codebases
Projects
Status: Done
Development

No branches or pull requests

1 participant