Skip to content

Commit 8fa3041

Browse files
lamarrrmeta-codesync[bot]
authored andcommitted
feat(cudf): Implement JIT Expression Evaluator for CUDF (facebookincubator#16075)
Summary: This pull request implements a JIT Expression evaluator for the CUDF layer (`JitExpression`). It reuses some of the functionality existing in the `AstExpression`. `JitExpression` is separate from `AstExpression` to enable us expand its feature set independent of `AstExpression` in the future. I.e. UDFs and JIT-specific passes. The `JitExpression` and `AstExpression` are only used in the `CudfHashJoinProbe` and `CudfHashJoinBuild` operations. Pull Request resolved: facebookincubator#16075 Reviewed By: xiaoxmeng Differential Revision: D92443713 Pulled By: kgpai fbshipit-source-id: 360940ebbf39ecb0f925c73f1bb02f37706ca393
1 parent 6beae86 commit 8fa3041

File tree

10 files changed

+883
-639
lines changed

10 files changed

+883
-639
lines changed

velox/experimental/cudf/CudfConfig.h

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,10 @@ struct CudfConfig {
3333
"cudf.ast_expression_enabled"};
3434
static constexpr const char* kCudfAstExpressionPriority{
3535
"cudf.ast_expression_priority"};
36+
static constexpr const char* kCudfJitExpressionEnabled{
37+
"cudf.jit_expression_enabled"};
38+
static constexpr const char* kCudfJitExpressionPriority{
39+
"cudf.jit_expression_priority"};
3640
static constexpr const char* kCudfAllowCpuFallback{"cudf.allow_cpu_fallback"};
3741
static constexpr const char* kCudfLogFallback{"cudf.log_fallback"};
3842

@@ -67,6 +71,9 @@ struct CudfConfig {
6771
/// Enable AST in expression evaluation
6872
bool astExpressionEnabled{true};
6973

74+
/// Enable JIT in expression evaluation
75+
bool jitExpressionEnabled{true};
76+
7077
/// Priority of AST expression. Expression with higher priority is chosen for
7178
/// a given root expression.
7279
/// Example:
@@ -76,6 +83,9 @@ struct CudfConfig {
7683
/// priority is 25 then standalone cudf function is chosen.
7784
int astExpressionPriority{100};
7885

86+
/// Priority of JIT expression.
87+
int jitExpressionPriority{101};
88+
7989
/// Whether to log a reason for falling back to Velox CPU execution.
8090
bool logFallback{true};
8191
};

velox/experimental/cudf/exec/ToCudf.cpp

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,7 @@
3131
#include "velox/experimental/cudf/exec/Utilities.h"
3232
#include "velox/experimental/cudf/expression/AstExpression.h"
3333
#include "velox/experimental/cudf/expression/ExpressionEvaluator.h"
34+
#include "velox/experimental/cudf/expression/JitExpression.h"
3435

3536
#include "folly/Conv.h"
3637
#include "velox/exec/AssignUniqueId.h"
@@ -518,6 +519,10 @@ void registerCudf() {
518519
registerAstEvaluator(CudfConfig::getInstance().astExpressionPriority);
519520
}
520521

522+
if (CudfConfig::getInstance().jitExpressionEnabled) {
523+
registerJitEvaluator(CudfConfig::getInstance().jitExpressionPriority);
524+
}
525+
521526
isCudfRegistered = true;
522527
}
523528

@@ -560,6 +565,9 @@ void CudfConfig::initialize(
560565
if (config.find(kCudfAstExpressionEnabled) != config.end()) {
561566
astExpressionEnabled = folly::to<bool>(config[kCudfAstExpressionEnabled]);
562567
}
568+
if (config.find(kCudfJitExpressionEnabled) != config.end()) {
569+
jitExpressionEnabled = folly::to<bool>(config[kCudfJitExpressionEnabled]);
570+
}
563571
if (config.find(kCudfAstExpressionPriority) != config.end()) {
564572
astExpressionPriority =
565573
folly::to<int32_t>(config[kCudfAstExpressionPriority]);

0 commit comments

Comments
 (0)