MCS graph construction utils - #230
Conversation
|
| Filename | Overview |
|---|---|
| src/mcs/mcs_graph.cpp | New CSR graph builder with validation; duplicate-edge and int-overflow concerns flagged in prior review threads |
| src/mcs/fmcs_cuda/fmcs_match_tables.cuh | Defines host/device bitmap match-table types and upload interface; clean struct layout, well-typed bit arithmetic |
| src/mcs/fmcs_cuda/fmcs_match_tables.cu | Implements contiguous device-side packing of match tables; offset accounting and stream usage are correct |
| tests/test_fmcs_foundations.cu | Good coverage of graph construction and table upload; tests sort order, symmetry, error paths, word-boundary packing, and empty cases |
| src/mcs/CMakeLists.txt | New CMake target wiring mcs_graph.cpp and fmcs_match_tables.cu into mcs_fmcs_foundations; include dirs and link deps look correct |
Reviews (4): Last reviewed commit: "Use project-rooted includes in fMCS foun..." | Re-trigger Greptile
| graph.numVertices = static_cast<int>(numVertices); | ||
| graph.numEdges = static_cast<int>(edges.size()); |
There was a problem hiding this comment.
numVertices and edges.size() are size_t, but the Graph struct stores int numVertices and int numEdges. The silent static_cast<int> truncates without any guard for values above INT_MAX. In practice molecule graphs are tiny, but an explicit check would make the expectation clear and catch misuse early.
| graph.numVertices = static_cast<int>(numVertices); | |
| graph.numEdges = static_cast<int>(edges.size()); | |
| if (numVertices > static_cast<size_t>(std::numeric_limits<int>::max()) || | |
| edges.size() > static_cast<size_t>(std::numeric_limits<int>::max())) { | |
| throw std::runtime_error("MCS graph vertex/edge count exceeds int capacity"); | |
| } | |
| graph.numVertices = static_cast<int>(numVertices); | |
| graph.numEdges = static_cast<int>(edges.size()); |
8f2d628 to
feb29f2
Compare
evasnow1992
left a comment
There was a problem hiding this comment.
Changes look good to me. Thanks!
|
As discussed I'll wait until CI is green and rebase before merging. |
feb29f2 to
52a0e9b
Compare
We use a simpler graph representation than substruct, since we don't need repeated label/recurse cycles and the scope of matching is typically more limited.
PR 3 towards #221