Conversation
Greptile SummaryThis PR fixes a critical SIGSEGV bug in Key Changes:
Root Cause: When Solution: Pass by const reference prevents copy construction, ensuring destructors only run once when the original object goes out of scope. Confidence Score: 5/5
Important Files Changed
Sequence DiagramsequenceDiagram
participant User as User Code
participant AllClose as allclose()
participant Exec as cudaExecutor
participant Events as CUDA Events
Note over User,Events: Before Fix (Pass by Value)
User->>+AllClose: allclose(dest, in1, in2, rtol, atol, exec)
Note over AllClose: Copy constructor called
AllClose->>Exec: Create copy of exec
Note over AllClose: Function executes
AllClose->>Exec: Destructor called on copy
Exec->>Events: cudaEventDestroy(start_)
Exec->>Events: cudaEventDestroy(stop_)
AllClose-->>-User: Return
User->>Exec: Destructor called on original
Exec->>Events: cudaEventDestroy() on already destroyed events
Note over Events: SIGSEGV! Events already destroyed
Note over User,Events: After Fix (Pass by const&)
User->>+AllClose: allclose(dest, in1, in2, rtol, atol, exec)
Note over AllClose: Reference to original exec
Note over AllClose: Function executes
AllClose-->>-User: Return (no destructor called)
User->>Exec: Destructor called on original (once)
Exec->>Events: cudaEventDestroy(start_)
Exec->>Events: cudaEventDestroy(stop_)
Note over Events: Success! Events destroyed once
|
There was a problem hiding this comment.
Additional Comments (3)
-
include/matx/transforms/chol/chol_cuda.h, line 131 (link)syntax: cannot assign to reference member after initialization
C++ references cannot be reassigned. With the reference member on line 61, this line will not compile.
-
include/matx/transforms/chol/chol_cuda.h, line 211 (link)syntax: update hash to use stream instead of executor reference
Note: If this suggestion doesn't match your team's coding style, reply to this and let me know. I'll remember it for next time!
-
include/matx/transforms/chol/chol_cuda.h, line 226 (link)syntax: update equality to use stream instead of executor reference
4 files reviewed, 4 comments
|
/build |
5 similar comments
|
/build |
|
/build |
|
/build |
|
/build |
|
/build |
|
/build |
1 similar comment
|
/build |
Fixes #1103