Skip to content

[CPU] Support CPU Code generation#17

Merged
LeiWang1999 merged 6 commits intomainfrom
cpu
Jan 17, 2025
Merged

[CPU] Support CPU Code generation#17
LeiWang1999 merged 6 commits intomainfrom
cpu

Conversation

@LeiWang1999
Copy link
Contributor

This pull request includes several significant changes to the codebase, primarily focusing on adding new functionalities, improving CPU and GPU kernel handling, and enhancing layout inference. The most important changes include adding new source files, updating existing functions to handle CPU kernels, and improving layout inference with additional checks and utilities.

New Source Files:

  • src/target/codegen_cpp.h: Added a new header file for generating C++ host code. This file includes the CodeGenTileLangCPP class with methods for initializing, adding functions, and printing various expressions and statements.
  • src/target/rt_mod_cpp.cc: Added a new source file for building the C++ host module. This file includes the BuildCPPHost function, which initializes the code generator and processes functions in the IRModule.
  • src/transform/annotate_device_regions.cc: Added a new source file for annotating device regions in the IR. This file includes the DeviceRegionAnnotater class and the AnnotateDeviceRegions function.

CPU and GPU Kernel Handling:

  • src/ir.cc: Updated the KernelLaunch function to handle CPU kernels by checking the tilelang_is_cpu_kernel_frame attribute and adjusting the grid and block size checks accordingly. [1] [2]
  • src/op/elem.cc: Updated the Copy::Lower function to handle CPU targets by adding a check for the target device type and vectorizing the thread loop if the target is a CPU. [1] [2]

Layout Inference Enhancements:

  • src/transform/layout_inference.cc: Added new utility functions for identifying dynamic and static shared memory and local fragments. Updated the BufferUseDefCollector class to include additional checks and improved the Run function to handle various layout inference scenarios. [1] [2]

Minor Changes:

  • CMakeLists.txt: Added new source files src/target/codegen_cpp.cc and src/target/rt_mod_cpp.cc to the build configuration.
  • src/tl_templates/cpu/common.h: Included additional headers for math and boolean operations.

These changes collectively enhance the functionality and robustness of the codebase, particularly in handling different target devices and improving layout inference.

@LeiWang1999 LeiWang1999 merged commit 9356eb6 into main Jan 17, 2025
6 checks passed
LeiWang1999 added a commit that referenced this pull request Feb 27, 2025
* remove code ql ci

* update comprehensive tilelang-benchmark link
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant