-
Notifications
You must be signed in to change notification settings - Fork 8
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
Upgrade MLIR with new IR print option #372
Conversation
WalkthroughThis pull request updates the version specifications for the Changes
Possibly related PRs
Thank you for using CodeRabbit. We offer it for free to the OSS community and would appreciate your support in helping us grow. If you find it useful, would you consider giving us a shout-out on your favorite social media? 🪧 TipsChatThere are 3 ways to chat with CodeRabbit:
Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments. CodeRabbit Commands (Invoked using PR comments)
Other keywords and placeholders
CodeRabbit Configuration File (
|
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.
Actionable comments posted: 1
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
📒 Files selected for processing (3)
dev-requirements.txt
(1 hunks)lib/beaver/mlir/pass_manager.ex
(2 hunks)test/memref_test.exs
(1 hunks)
✅ Files skipped from review due to trivial changes (1)
- dev-requirements.txt
🔇 Additional comments (2)
lib/beaver/mlir/pass_manager.ex (1)
25-26
: Consider adding validation and documentation for tree_printing_path.
While the implementation is functional, consider these improvements:
- Add validation for the path value
- Document the expected path format and behavior
- Consider handling path existence/permissions
Here's a suggested improvement:
def enable_ir_printing(%MLIR.PassManager{} = pm, opts \\ []) do
+ tree_path = Keyword.get(opts, :tree_printing_path, "")
+ # Validate path if provided
+ unless tree_path == "" do
+ unless File.dir?(Path.dirname(tree_path)) do
+ raise ArgumentError, "Directory for tree_printing_path does not exist: #{tree_path}"
+ end
+ end
MLIR.CAPI.mlirPassManagerEnableIRPrinting(
pm,
!!Keyword.get(opts, :before_all, false),
!!Keyword.get(opts, :after_all, true),
!!Keyword.get(opts, :module_scope, false),
!!Keyword.get(opts, :after_only_on_change, false),
!!Keyword.get(opts, :after_only_on_failure, false),
- MLIR.StringRef.create(Keyword.get(opts, :tree_printing_path, ""))
+ MLIR.StringRef.create(tree_path)
)
end
Let's verify the MLIR API usage:
test/memref_test.exs (1)
42-42
: Verify the removal of 'finalizing-bufferize' operation
The removal of 'finalizing-bufferize' from the operation list might impact the memory management pipeline. While the test passes, we should verify this change is intentional and aligns with the MLIR upgrade.
Let's check the codebase for similar patterns and MLIR documentation:
✅ Verification successful
Removal of 'finalizing-bufferize' is consistent with codebase patterns
The codebase search reveals that 'finalizing-bufferize' is not used anywhere else, while the current pattern follows established MLIR operation sequences:
- 'one-shot-bufferize' is used in both memref and tosa tests
- 'buffer-deallocation' is consistently used with 'convert-linalg-to-loops'
- The change aligns with modern MLIR patterns where 'one-shot-bufferize' replaces older bufferization passes
🏁 Scripts executed
The following scripts were executed for the analysis:
Script:
#!/bin/bash
# Description: Search for other uses of these operations to understand the pattern
# and verify if this change is consistent across the codebase
# Check for other uses of finalizing-bufferize
echo "Searching for other uses of finalizing-bufferize..."
rg "finalizing-bufferize" -B 2 -A 2
# Check for patterns of buffer-deallocation and convert-linalg-to-loops
echo "Searching for similar operation patterns..."
rg "buffer-deallocation.*convert-linalg-to-loops|convert-linalg-to-loops.*buffer-deallocation" -B 2 -A 2
# Check if there are any relevant comments or documentation
echo "Searching for related documentation..."
fd -e md -e txt . -x rg -l "finalizing.?bufferize|buffer.?deallocation"
Length of output: 763
Script:
#!/bin/bash
# Let's try a broader search to understand the context and changes
# Check git history for the specific line changes in this file
echo "Checking git history for the specific file..."
git log -L 42,42:test/memref_test.exs
# Search for any MLIR-related configuration or version files
echo "Searching for MLIR configuration files..."
fd -e ex -e exs -e conf . -x rg -l "mlir.*version|MLIR.*VERSION"
# Look for any test files or documentation containing MLIR operation patterns
echo "Searching for MLIR operation patterns in tests..."
fd -e ex -e exs . -x rg "Beaver\.Composer\.nested.*\~w\{.*\}"
# Search for any comments or documentation about buffer operations
echo "Searching for buffer operation documentation..."
rg -g "*.{ex,exs,md}" "(?i)(bufferize|buffer.?deallocation)"
Length of output: 989
Summary by CodeRabbit
New Features
Bug Fixes
mlir
package to enhance compatibility across platforms.Tests