Skip to content
Merged
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
10 changes: 10 additions & 0 deletions csrc/src/static_switch.h
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,16 @@
#define EVENK_SWITCH BOOL_SWITCH
#endif

#ifdef FLASHATTENTION_DISABLE_SOFTCAP
#define SOFTCAP_SWITCH(COND, CONST_NAME, ...) \
[&] { \
Copy link

Copilot AI Jun 23, 2025

Choose a reason for hiding this comment

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

The COND parameter is unused when FLASHATTENTION_DISABLE_SOFTCAP is defined, which may trigger an unused-parameter warning. Consider explicitly casting it away (e.g., (void)COND;) inside the lambda.

Suggested change
[&] { \
[&] { \
(void)COND; \

Copilot uses AI. Check for mistakes.
Copy link

Copilot AI Jun 23, 2025

Choose a reason for hiding this comment

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

The lambda capture list uses [&] but doesn't actually capture anything. For clarity and to avoid unexpected captures, use an empty capture list [].

Suggested change
[&] { \
[] { \

Copilot uses AI. Check for mistakes.
constexpr static bool CONST_NAME = false; \
Copy link

Copilot AI Jun 23, 2025

Choose a reason for hiding this comment

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

Using a macro parameter as a variable name (CONST_NAME) risks collisions. Consider generating a unique identifier (e.g., via __LINE__) or clearly documenting that callers must provide a unique name.

Copilot uses AI. Check for mistakes.
return __VA_ARGS__(); \
}()
#else
#define SOFTCAP_SWITCH BOOL_SWITCH
#endif

#define FP16_SWITCH(COND, ...) \
[&] { \
if (COND) { \
Expand Down