Conversation
- getMaybeHeuristicsFor / getMaybeHeuristicParams return unique_ptr (nullptr = no value) - Update call sites: .has_value() -> != nullptr, remove valueOrError for heuristics - Use NVF_ERROR for heuristics_ check in FusionKernelRuntime Co-authored-by: Cursor <cursoragent@cursor.com>
Greptile SummaryThis PR refactors the heuristics API by removing the redundant
The refactoring is straightforward and improves code clarity by eliminating the double-indirection pattern. Confidence Score: 5/5
Important Files Changed
Last reviewed commit: 2558dc5 |
Description
|
| Relevant files | |||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| Enhancement |
|
PR Reviewer Guide
Here are some key observations to aid the review process:
| 🧪 No relevant tests |
| 🔒 No security concerns identified |
| ⚡ Recommended focus areas for review |
Logic Error in Kernel Reuse
new_heuristics by reference but then assigns to it inside the lambda. However, the assignment new_heuristics = kernel_runtime->getMaybeHeuristicsFor(...) happens after the return statement, making it unreachable. This breaks the kernel reuse functionality as new_heuristics will never be populated with the found runtime's heuristics. |
Summary:
std::optional<std::unique_ptr<T>>is redundant sinceunique_ptrcan represent "no value" vianullptr.Changes:
getMaybeHeuristicsFor/getMaybeHeuristicParamsnow returnstd::unique_ptr<T>(nullptr when unavailable)..has_value()→!= nullptr, removedvalueOrErrorfor heuristics path.FusionKernelRuntimeconstructor usesNVF_ERROR(heuristics_ != nullptr)aftergetMaybeHeuristicsFor.Files: fusion_kernel_runtime.{h,cpp}, fusion_segmenter.{h,cpp}, fusion_executor_cache.cpp, benchmarks (heuristic_*.cpp, shape_inference.cpp).
Made with Cursor