Skip to content

Commit e474268

Browse files
authored
Adds conditional softcap switch macro
2 parents 73caf73 + 0cbea0c commit e474268

File tree

1 file changed

+10
-0
lines changed

1 file changed

+10
-0
lines changed

csrc/src/static_switch.h

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,16 @@
4646
#define EVENK_SWITCH BOOL_SWITCH
4747
#endif
4848

49+
#ifdef FLASHATTENTION_DISABLE_SOFTCAP
50+
#define SOFTCAP_SWITCH(COND, CONST_NAME, ...) \
51+
[&] { \
52+
constexpr static bool CONST_NAME = false; \
53+
return __VA_ARGS__(); \
54+
}()
55+
#else
56+
#define SOFTCAP_SWITCH BOOL_SWITCH
57+
#endif
58+
4959
#define FP16_SWITCH(COND, ...) \
5060
[&] { \
5161
if (COND) { \

0 commit comments

Comments
 (0)