-
Notifications
You must be signed in to change notification settings - Fork 404
[circt-verilog-lsp] Minimize project-scope File IO #9056
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
fc58142 to
3e93c5f
Compare
uenoku
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Question on shared pointer but otherwise LGTM
lib/Tools/circt-verilog-lsp-server/VerilogServerImpl/VerilogDocument.cpp
Outdated
Show resolved
Hide resolved
lib/Tools/circt-verilog-lsp-server/VerilogServerImpl/VerilogTextFile.cpp
Show resolved
Hide resolved
lib/Tools/circt-verilog-lsp-server/VerilogServerImpl/VerilogTextFile.h
Outdated
Show resolved
Hide resolved
lib/Tools/circt-verilog-lsp-server/VerilogServerImpl/VerilogDocument.cpp
Outdated
Show resolved
Hide resolved
lib/Tools/circt-verilog-lsp-server/VerilogServerImpl/VerilogDocument.cpp
Outdated
Show resolved
Hide resolved
18429d7 to
ebf4c6d
Compare
Reduce filesystem I/O overhead caused by repeated re-opening and reparsing of project files in the Verilog LSP server when using the `-C` option. For a large, SoC-scale project this approach reduces parsing time from ~1s to 0.75s. This implementation also correctly indexes the editor-state rather than the file system state of the main buffer. - **Introduced shared `projectDriver`:** A persistent `slang::driver::Driver` is now created once per project and passed to all `VerilogDocument` instances to reuse loaded files and avoid redundant disk access. - **Refactored `VerilogDocument` initialization:** - Removed per-buffer command file parsing and main-file filtering logic. - Added `setTopModules()` and `copyBuffers()` helpers to extract top-level modules and reuse in-memory buffers from `projectDriver` instead of reading from disk. - **Inheritance of project context:** - Copied defines/undefines directly from the shared driver. - Added placeholder for include path copying (TODO). - Library search directories are now applied once at construction. - **VerilogTextFile integration:** - Added `initializeProjectDriver()` to parse all command files once and hold a shared driver reference for reuse.
ebf4c6d to
bafc2ae
Compare
Thanks for the review! I think I addressed the points you raised, but I'll keep this open for a day or so before merging, just in case you'd like to have another look. |
uenoku
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks great!
Reduce filesystem I/O overhead caused by repeated re-opening and reparsing of project files in the Verilog LSP server when using the
-Coption. For a large, SoC-scale project this approach reduces parsing time from ~1s to 0.75s.This implementation also correctly indexes the editor-state rather than the file system state of the main buffer.
projectDriver: A persistentslang::driver::Driveris now created once per project and passed to allVerilogDocumentinstances to reuse loaded files and avoid redundant disk access.VerilogDocumentinitialization:setTopModules()andcopyBuffers()helpers to extract top-level modules and reuse in-memory buffers fromprojectDriverinstead of reading from disk.initializeProjectDriver()to parse all command files once and hold a shared driver reference for reuse.