When I build this repo with MSVC, it shows the following error: [code] Fix the error.…
- User
When I build this repo with MSVC, it shows the following error:
code - Assistant
Inspecting the Proton data types around
TreeData,TraceData, andPhaseStoreto identify where MSVC requires complete types. - Assistant
The nested payload types look forward-declared in headers and likely defined only in
.cppfiles; I’m checking where they’re defined and howPhaseStoreinstantiates them. - Assistant
I found the cross-compiler issue:
PhaseStore<T>allocatesTinline in the header, and MSVC instantiates that whileTree/Traceare still only forward-declared. I’m switching the store to use constructor-supplied create/destroy callbacks so those allocations only happen in the.cppfiles where the nested types are complete. - Assistant
The fix is in place. I’m doing a quick pass over the touched declarations/definitions to make sure the new callback-based store wiring is internally consistent without running a build.
- Assistant
Fixed the MSVC incomplete-type error.
What changed:
third_party/proton/csrc/include/Data/PhaseStore.h:26ChangedPhaseStore<T>so it no longer doesstd::make_unique<T>()in the header. It now takes create/destroy callbacks and storesstd::unique_ptr<T, DeleteFn>.third_party/proton/csrc/include/Data/TreeData.h:50Added private static helperscreateTree/destroyTree.third_party/proton/csrc/include/Data/TraceData.h:49Added private static helperscreateTrace/destroyTrace.third_party/proton/csrc/lib/Data/TreeData.cpp:153and:772Defined the tree helpers and wired them intotreePhases.third_party/proton/csrc/lib/Data/TraceData.cpp:133and:513Defined the trace helpers and wired them intotracePhases.
Why this fixes it:
- MSVC was instantiating
PhaseStore<TreeData::Tree>andPhaseStore<TraceData::Trace>from the headers while those nested types were still only forward-declared.
- User
As we're maintaining a fork, can you minimize the diff? You may read the code in
main-windowsbranch, which is known to build successfully. - Assistant
Checking how
main-windowshandles these Proton types so I can shrink the fix toward the branch’s existing pattern instead of carrying a larger local refactor. - Assistant
I found a smaller version of the fix:
PhaseStorecan keep the callback-based allocation, but the callbacks can be passed directly from theTreeData/TraceDataconstructors with lambdas. That lets me drop all header changes and keep the diff to the store plus two.cppconstructors. - Assistant
The current patch still works, but I want to confirm the worktree is exactly the smaller version and not carrying any leftover header churn from my first pass.
- Assistant
I found staged leftovers from my first pass on the same files. I’m checking whether those staged changes are only my intermediate edits so I can keep the final repo diff clean without touching anything unrelated.
- Assistant
The staged changes are only my discarded intermediate version. I’m unstaging just these touched files so the final diff reflects the smaller fix only.
- Assistant
Minimized the fix.
What I changed:
third_party/proton/csrc/include/Data/PhaseStore.hPhaseStore<T>now takes create/delete function pointers.- It stores
std::unique_ptr<T, DeleteFn>and callscreateFn()instead ofstd::make_unique<T>().
third_party/proton/csrc/lib/Data/TreeData.cpp:768treePhasesis constructed with lambdas thatnew/deleteTree.
third_party/proton/csrc/lib/Data/TraceData.cpp:509tracePhasesis constructed with lambdas thatnew/deleteTrace.
Why this is smaller:
- No header changes to
TreeData.horTraceData.h. - Final diff is down to 3 files.
- The public class layout stays closer to
main-windows.
Why it fixes MSVC:
- MSVC was instantiating
PhaseStore<Tree>/ while those nested types were only forward-declared.
- User
- Assistant
Checking the example plugin against
main-windowsto align the export annotation with the branch’s Windows-compatible pattern and keep the diff minimal. - Assistant
The failing source is behind
main-windows: that branch exports a singletritonGetPluginInfo()entry point, and it also avoids-fvisibility=hiddenunder MSVC. I’m checking the plugin API header so I can mirror the branch’s exact ABI pattern instead of patching around the bad macro use locally. - Assistant
The macro itself is the cross-platform problem, and there’s also a Windows-specific
-fvisibility=hiddenwarning in the example CMake. I’m checking the dialect plugin example too so one small change doesn’t leave the next MSVC failure waiting in the tree. - Assistant
Applying the smaller cross-platform fix: make the plugin export macro Windows-safe in one header, and guard the example-only visibility flag in the two example CMake files to match
main-windows. - Assistant
The changes are in. I’m comparing them against
main-windowsso the final diff stays as close as possible to the branch’s existing Windows handling. - Assistant
Fixed the MSVC plugin export issue with a small Windows-only compatibility patch.
Changed:
include/triton/Tools/PluginUtils.h- Made
TRITON_PLUGIN_APIandTRITON_PLUGIN_API_TYPEuse__declspec(dllexport)on_WIN32. - Kept the existing GCC/Clang visibility attribute on non-Windows.
- Made
examples/plugins/CMakeLists.txt- Guarded
-fvisibility=hiddenwithif(NOT MSVC).
- Guarded
examples/plugins/DialectPlugins/DialectPlugin/lib/DialectPlugin/CMakeLists.txt- Guarded
-fvisibility=hiddenwithif(NOT MSVC).
- Guarded
Why this fixes it:
- MSVC does not understand
__attribute__((visibility("default"))), so the export macro expanded into invalid syntax inTritonPlugin.cpp. - The example plugin CMake was also passing a GCC-only visibility flag to
cl, whichmain-windowsalready avoids.
This keeps the diff small and follows the
main-windowspattern for Windows handling.I did not run a build.