-
Notifications
You must be signed in to change notification settings - Fork 29
Martien.solve xm #731
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
base: aie-public
Are you sure you want to change the base?
Martien.solve xm #731
Conversation
This makes the solver hit a feasible solution, rather than having an infeasible solution be rejected by the final check and moving on to II=3
This commit introduces the foundational infrastructure for generalized slot occupancy tracking that unifies regular slots and multi-slot pseudos (MSPs). Key additions: - AIESlotStructure.h: Interface for querying slot structure information including slot definitions, MSP compositions, and capacity bounds - AIESlotOccupancy.h/.cpp: Generalized slot occupancy model using occupation counts per slot class, with conflict detection logic - CMakeLists.txt: Add AIESlotOccupancy.cpp to build The SlotOccupancy model treats regular slots as slot classes with capacity 1 and MSPs as slot classes with capacity > 1. Conflict detection uses three-layer checking: capacity bounds, total occupancy, and materialization feasibility. This infrastructure will be used by the hazard recognizer and scheduler to handle slot conflicts in a unified way.
…erface This commit adds transitional infrastructure to prepare for migrating from SlotBits to SlotOccupancy in the hazard recognizer. Key changes: - AIEHazardRecognizer.h: Add SlotBitsWrapper class that wraps uint64_t and provides a SlotOccupancy-like interface for gradual migration. Also update copyright year to 2023-2025. - AIEMCFormats.h: Add forward declaration for AIESlotStructure and declare virtual getSlotStructure() method - AIEBaseMCFormats.cpp: Implement stub SlotStructure that will be overridden by concrete format classes The SlotBitsWrapper provides methods like isEmpty(), clear(), blockResources(), and overlaps() that match the SlotOccupancy API, allowing code to be written against the new interface while still using the old uint64_t representation internally. This enables incremental migration of hazard checking code from SlotBits to the new SlotOccupancy model.
- Refactored SlotOccupancy::tryMaterializeMSPs to work directly with
SlotOccupancy instead of dense array representation
- Simplified recursive search interface from 7 parameters to 3
- Improved assignment loop: outer loop iterates over Count, inner logic
finds next available slot using llvm::countr_zero
- Added getCount() and setCount() public methods to SlotOccupancy
- Created MSPSlotMapping class for iterative slot materialization queries
- Computes legal materialization in constructor
- Maintains internal counters for each MSP class
- Updates CurrentOccupancy as materializations are retrieved
- Unified interface: materializeAlternative() works for both real slots
and MSPs
- Uses same greedy assignment algorithm as conflict detection
- Added comprehensive unit tests for MSPSlotMapping covering:
- Empty mappings
- Real slots only
- Single and multiple MSP instances
- Mixed real slots and MSPs
- Multiple MSP classes
- Complex bundles
- Iterative retrieval
- Updated .clinerules with new coding standards:
- C++ class member ordering (private first, public last)
- Const correctness for local variables
- Build verification using ninja check-llvm-codegen-aie
Removed SlotOccupancy(ClassIdx, Count) constructor which was only used in tests. Replaced with makeOccupancy() utility function in the test file that uses operator|= with SlotBits values.
Renamed SlotOccupancy::getCount() to at() to align with STL conventions like std::vector::at(). Updated all usages in implementation and tests.
Replaced countr_zero-based loops with BitMask iteration to avoid repeatedly scanning from the beginning. BitMask and Bit are now initialized together and advanced in lockstep through the loop.
Added BitMask != 0 check in while loop condition to prevent infinite loop when running out of available slots. This ensures the loop terminates and properly returns false when insufficient slots are available. The bug was caught by the ComplexBundle test which has an infeasible bundle configuration.
Changed the test from an infeasible bundle (Real A + S + 2x MSP_AB + MSP_AXM)
to a feasible one (Real S + 1x MSP_AB + 1x MSP_AXM). The original bundle
was infeasible because MSP_AB needs 2 slots from {A,B} but A was occupied,
leaving only B for 2 instances.
Created assignMSPInstances() template function to eliminate code duplication between tryMaterializeMSPs and tryMaterializeMSPsWithMapping. The template takes an AssignmentHandler functor to optionally record assignments. Also fixed ComplexBundle test to use a feasible bundle configuration. All tests pass.
Never add build trees (Release/, Debug/) or IDE directories (.cline_storage/) to git commits. Always explicitly specify source files when committing.
- Added AIESlotStructure::getCapacityBounds() to compute capacity bounds as a SlotOccupancy object - Changed SlotOccupancy::boundedBy() to take SlotOccupancy parameter instead of SlotStructure, making it more general - Updated conflict() to compute and use capacity bounds - Updated test to use new interface All tests pass.
| After making changes to AIE target code, verify the changes by running the AIE CodeGen tests: | ||
|
|
||
| ```bash | ||
| cd Release && ninja check-llvm-codegen-aie |
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.
Maybe ask for a user preference. For example, I follow other naming convention.
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.
You can now include a user profile and inspect a variable to check from which codebase it comes.
Extended CodeGenFormat TableGen backend to generate SlotStructure tables that unify MSPs and regular slots in a single MultiSlotClass index domain. Added MSP composition and materialization mappings to FormatInterface. Key changes: - New MultiSlotClass enum type for unified slot class indices - Generated tables: compositions, MSP→class mapping, MSP materialization - SlotStructure implementations for AIE1/AIE2/AIE2P - FormatInterface methods: getMultiSlotClass(), getMaterializedOpcode() - Enables future deprecation of AlternateOpcodes APIs See llvm/lib/Target/AIE/docs/SlotStructureUnification.md for details. Tests: SlotOccupancy 20/20 pass, AIE CodeGen 1802/1803 pass
24759d1 to
dae5e17
Compare
WIP to correct the solver model for the XM slot.
Also contains preparations to keep track of possible MSP materializations in the scoreboard without actually materializing.
All coding in those commits was done by Cline in CNN mode (Continuous Nitpicking and Nagging). I added a set of our accepted coding rules for cline.