Skip to content
Closed
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
23 changes: 23 additions & 0 deletions csrc/nv_internal/tensorrt_llm/common/envUtils.h
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,10 @@
#include <cstdint>
#include <optional>
#include <string>
#include <utility>

#include <cuda_runtime_api.h>
#include "flashinfer/exception.h"

namespace tensorrt_llm::common {
// Useful when you want to inject some debug code controllable with env var.
Expand Down Expand Up @@ -101,4 +105,23 @@ int getEnvMoeA2ADispatchBlockSize();
// Block size (threads per block) for MoE A2A Combine kernels (default 256 if unset or invalid)
int getEnvMoeA2ACombineBlockSize();

template <typename KernelFn, typename... Args>
inline void launchWithPdlWhenEnabled(char const* name, bool enable_pdl, KernelFn kernelFn,
dim3 grid, dim3 block, size_t dynamicShmSize, cudaStream_t stream, Args&&... args)
{
cudaLaunchConfig_t kernelConfig;
kernelConfig.gridDim = grid;
kernelConfig.blockDim = block;
kernelConfig.dynamicSmemBytes = dynamicShmSize;
kernelConfig.stream = stream;
cudaLaunchAttribute attrs[1];
attrs[0].id = cudaLaunchAttributeProgrammaticStreamSerialization;
attrs[0].val.programmaticStreamSerializationAllowed = enable_pdl;
kernelConfig.attrs = attrs;
kernelConfig.numAttrs = 1;
cudaError_t e = cudaLaunchKernelEx(&kernelConfig, kernelFn, std::forward<Args>(args)...);
FLASHINFER_CHECK(e == cudaSuccess, "cudaLaunchKernelEx (", name, ") failed: ",
cudaGetErrorString(e));
}
Comment on lines +108 to +125

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue | 🟡 Minor

Commit the clang-format output for this helper.

Pre-commit is failing because clang-format rewrote this file’s include order/signature/body wrapping. Please run formatting and commit the result so CI can pass.

🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@csrc/nv_internal/tensorrt_llm/common/envUtils.h` around lines 108 - 125, Run
clang-format and commit the formatted version of the helper function
launchWithPdlWhenEnabled in envUtils.h: apply your project's clang-format
configuration to reformat the include order, signature/wrapping and function
body (the cudaLaunchConfig_t setup, attrs array, and cudaLaunchKernelEx call),
then stage and commit the changed file so the pre-commit CI hook stops failing.


} // namespace tensorrt_llm::common
Loading
Loading