Commit f2e99180 authored by Lei Wang's avatar Lei Wang Committed by LeiWang1999
Browse files

[Refactor] Phaseout LLVM Dependency by Making it Optional (#247)

* remove llvm build

* [Refactor] Update kernel compilation and profiling in examples

- Replaced `tilelang.lower` with `tilelang.compile` in multiple example scripts to streamline kernel compilation.
- Updated profiling calls to utilize the new `get_profiler` method, enhancing performance measurement consistency.
- Adjusted assertions and benchmarking methods to align with the new profiling structure across various examples, ensuring correctness and clarity in performance evaluations.

* lint fix

* License Update

* [Refactor] Improve code formatting and documentation in CUDA header and HIP runtime files

- Adjusted formatting in `cuda.h` for better readability, including alignment of comments and struct fields.
- Cleaned up whitespace and improved comment clarity in `rt_mod_hip.cc` to enhance code maintainability.

* [Refactor] Enhance formatting and clarity in CUDA header and HIP runtime files

- Improved comment alignment and readabilit...
parent 43bd9d3e
// Copyright (c) Microsoft Corporation.
// Licensed under the MIT License.
/*! /*!
* \file layout/utils.cc * \file layout/utils.cc
* \brief Some arith tools for layout & fragment inference * \brief Some arith tools for layout & fragment inference
......
// Copyright (c) Microsoft Corporation.
// Licensed under the MIT License.
/*! /*!
* \file layout/utils.h * \file layout/utils.h
* \brief Some arith tools for layout & fragment inference * \brief Some arith tools for layout & fragment inference
......
// Copyright (c) Microsoft Corporation.
// Licensed under the MIT License.
/*! /*!
* \file tl/op/bulk_copy.h * \file tl/op/bulk_copy.h
* \brief Bulk copy operator. * \brief Bulk copy operator.
......
// Copyright (c) Microsoft Corporation.
// Licensed under the MIT License.
/*! /*!
* \file tl/op/elem.cc * \file tl/op/elem.cc
* *
......
// Copyright (c) Microsoft Corporation.
// Licensed under the MIT License.
/*! /*!
* \file tl/op/elem.h * \file tl/op/elem.h
* \brief Define elment-wise operators. * \brief Define elment-wise operators.
......
// Copyright (c) Microsoft Corporation.
// Licensed under the MIT License.
/*! /*!
* \file tl/op/gemm.cc * \file tl/op/gemm.cc
* *
......
// Copyright (c) Microsoft Corporation.
// Licensed under the MIT License.
/*! /*!
* \file tl/op/gemm.h * \file tl/op/gemm.h
* \brief Define gemm operator. * \brief Define gemm operator.
......
// Copyright (c) Microsoft Corporation.
// Licensed under the MIT License.
/*! /*!
* \file tl/op/op.cc * \file tl/op/op.cc
* *
......
// Copyright (c) Microsoft Corporation.
// Licensed under the MIT License.
/*! /*!
* \file tl/op/parallel.h * \file tl/op/parallel.h
* \brief Infer layout from ops and parallel for * \brief Infer layout from ops and parallel for
......
// Copyright (c) Microsoft Corporation.
// Licensed under the MIT License.
/*! /*!
* \file tl/op/reduce.cc * \file tl/op/reduce.cc
* *
......
// Copyright (c) Microsoft Corporation.
// Licensed under the MIT License.
/*! /*!
* \file tl/op/reduce.h * \file tl/op/reduce.h
* \brief Define reduce operator. * \brief Define reduce operator.
......
// Copyright (c) Microsoft Corporation.
// Licensed under the MIT License.
/*! /*!
* \file tl/runtime/runtime.h * \file tl/runtime/runtime.h
* \brief Runtime functions. * \brief Runtime functions.
......
// Copyright (c) Microsoft Corporation.
// Licensed under the MIT License.
/*! /*!
* \file tl/runtime/runtime.h * \file tl/runtime/runtime.h
* \brief Runtime functions. * \brief Runtime functions.
......
// Copyright (c) Microsoft Corporation.
// Licensed under the MIT License.
/*! /*!
* \file target/codegen.cc * \file target/codegen.cc
*/ */
......
// Copyright (c) Microsoft Corporation.
// Licensed under the MIT License.
/*! /*!
* \file target/codegen.h * \file target/codegen.h
* \brief Utility to generate code * \brief Utility to generate code
......
// Copyright (c) Microsoft Corporation.
// Licensed under the MIT License.
/*! /*!
* \file target/codegen.cc * \file target/codegen.cc
*/ */
......
// Copyright (c) Microsoft Corporation.
// Licensed under the MIT License.
/*! /*!
* \file target/codegen.h * \file target/codegen.h
* \brief Utility to generate code * \brief Utility to generate code
......
// Copyright (c) Microsoft Corporation.
// Licensed under the MIT License.
/* /*
* Copyright 1993-2023 NVIDIA Corporation. All rights reserved. * Copyright 1993-2023 NVIDIA Corporation. All rights reserved.
* *
...@@ -2230,12 +2228,14 @@ typedef struct CUgraphEdgeData_st { ...@@ -2230,12 +2228,14 @@ typedef struct CUgraphEdgeData_st {
::CU_GRAPH_KERNEL_NODE_PORT_LAUNCH_ORDER. */ ::CU_GRAPH_KERNEL_NODE_PORT_LAUNCH_ORDER. */
unsigned char unsigned char
to_port; /**< This indicates what portion of the downstream node is to_port; /**< This indicates what portion of the downstream node is
dependent on the upstream node or portion thereof (indicated dependent on the upstream node or portion thereof
by \c from_port). The meaning is specific to the node type. A (indicated by \c from_port). The meaning is
value of 0 in all cases means the entirety of the downstream specific to the node type. A value of 0 in all
node is dependent on the upstream work. <br> Currently no node cases means the entirety of the
types define non-zero ports. Accordingly, this field must be downstream node is dependent on the
set to zero. */ upstream work. <br> Currently no
node types define non-zero ports. Accordingly,
this field must be set to zero. */
unsigned char type; /**< This should be populated with a value from unsigned char type; /**< This should be populated with a value from
::CUgraphDependencyType. (It is typed as char due to ::CUgraphDependencyType. (It is typed as char due to
compiler-specific layout of bitfields.) See compiler-specific layout of bitfields.) See
...@@ -2499,8 +2499,10 @@ typedef union CUlaunchAttributeValue_union { ...@@ -2499,8 +2499,10 @@ typedef union CUlaunchAttributeValue_union {
::CU_LAUNCH_ATTRIBUTE_ACCESS_POLICY_WINDOW. */ ::CU_LAUNCH_ATTRIBUTE_ACCESS_POLICY_WINDOW. */
int cooperative; /**< Value of launch attribute int cooperative; /**< Value of launch attribute
::CU_LAUNCH_ATTRIBUTE_COOPERATIVE. Nonzero indicates a ::CU_LAUNCH_ATTRIBUTE_COOPERATIVE. Nonzero indicates a
cooperative kernel (see ::cuLaunchCooperativeKernel). */ cooperative kernel (see
CUsynchronizationPolicy syncPolicy; /**< Value of launch attribute ::cuLaunchCooperativeKernel). */
CUsynchronizationPolicy
syncPolicy; /**< Value of launch attribute
::CU_LAUNCH_ATTRIBUTE_SYNCHRONIZATION_POLICY. ::CU_LAUNCH_ATTRIBUTE_SYNCHRONIZATION_POLICY.
::CUsynchronizationPolicy for work ::CUsynchronizationPolicy for work
queued up in this stream */ queued up in this stream */
...@@ -2524,8 +2526,8 @@ typedef union CUlaunchAttributeValue_union { ...@@ -2524,8 +2526,8 @@ typedef union CUlaunchAttributeValue_union {
CUclusterSchedulingPolicy CUclusterSchedulingPolicy
clusterSchedulingPolicyPreference; /**< Value of launch attribute clusterSchedulingPolicyPreference; /**< Value of launch attribute
::CU_LAUNCH_ATTRIBUTE_CLUSTER_SCHEDULING_POLICY_PREFERENCE. ::CU_LAUNCH_ATTRIBUTE_CLUSTER_SCHEDULING_POLICY_PREFERENCE.
Cluster scheduling policy preference Cluster scheduling policy
for the kernel. */ preference for the kernel. */
int programmaticStreamSerializationAllowed; /**< Value of launch attribute int programmaticStreamSerializationAllowed; /**< Value of launch attribute
::CU_LAUNCH_ATTRIBUTE_PROGRAMMATIC_STREAM_SERIALIZATION. ::CU_LAUNCH_ATTRIBUTE_PROGRAMMATIC_STREAM_SERIALIZATION.
*/ */
// Copyright (c) Microsoft Corporation.
// Licensed under the MIT License.
#include "codegen_cpp.h" #include "codegen_cpp.h"
namespace tvm { namespace tvm {
......
// Copyright (c) Microsoft Corporation.
// Licensed under the MIT License.
#include "codegen_cuda.h" #include "codegen_cuda.h"
#include "runtime/cuda/cuda_module.h" #include "runtime/cuda/cuda_module.h"
...@@ -70,7 +67,7 @@ runtime::Module BuildTileLangCUDA(IRModule mod, Target target) { ...@@ -70,7 +67,7 @@ runtime::Module BuildTileLangCUDA(IRModule mod, Target target) {
return runtime::CUDAModuleCreate(ptx, fmt, ExtractFuncInfo(mod), code); return runtime::CUDAModuleCreate(ptx, fmt, ExtractFuncInfo(mod), code);
} }
String BuildTLDebug(IRModule mod, Target target) { runtime::Module BuildTileLangCUDAWithoutCompile(IRModule mod, Target target) {
using tvm::runtime::Registry; using tvm::runtime::Registry;
bool output_ssa = false; bool output_ssa = false;
CodeGenTileLangCUDA cg; CodeGenTileLangCUDA cg;
...@@ -90,13 +87,13 @@ String BuildTLDebug(IRModule mod, Target target) { ...@@ -90,13 +87,13 @@ String BuildTLDebug(IRModule mod, Target target) {
if (const auto *f = Registry::Get("tilelang_callback_cuda_postproc")) { if (const auto *f = Registry::Get("tilelang_callback_cuda_postproc")) {
code = (*f)(code, target).operator std::string(); code = (*f)(code, target).operator std::string();
} }
return String(code); return runtime::CUDAModuleCreate("ptx", "ptx", ExtractFuncInfo(mod), code);
} }
TVM_REGISTER_GLOBAL("target.build.tilelang_cuda") TVM_REGISTER_GLOBAL("target.build.tilelang_cuda")
.set_body_typed(BuildTileLangCUDA); .set_body_typed(BuildTileLangCUDA);
TVM_REGISTER_GLOBAL("target.build.tl_debug_codegen") TVM_REGISTER_GLOBAL("target.build.tilelang_cuda_without_compile")
.set_body_typed(BuildTLDebug); .set_body_typed(BuildTileLangCUDAWithoutCompile);
} // namespace codegen } // namespace codegen
} // namespace tvm } // namespace tvm
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment