Skip to content
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

Function to estimate stack size (using existing tooling) #1121

Merged
merged 1 commit into from
Feb 21, 2025

Conversation

newling
Copy link
Contributor

@newling newling commented Feb 20, 2025

This will replace #1116 -- instead of string matching the assembly file, it uses llvm's llvm-readelf after adding --stack-size-section to the llc call.

Copy link
Collaborator

@jtuyls jtuyls left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM, just some nits and question

llvm::errs() << "Failed to get upper bounds of stack sizes\n";
return failure();
}
auto upperBounds = std::move(maybeUpperBounds.value());
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
auto upperBounds = std::move(maybeUpperBounds.value());
llvm::DenseMap<std::pair<uint32_t, uint32_t>, uint32_t> upperBounds = std::move(maybeUpperBounds.value());

llvm::errs() << "Failed to assemble ll with peano\n";
return failure();
}

// If this is not windows, we can do this check. On windows checkTool
// doesn't pipe outputs correctly.
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

outputs being the stack sizes right?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah, in runTool the piping is gated on WIN32. Specifically I think it's this redirection for windows redirects = {{}, {}, {}} which means we don't get the logging back (and I don't want to sink hours into fixing this now!)

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

(I've reworded)

mlir::FailureOr<llvm::DenseMap<std::pair<uint32_t, uint32_t>, uint32_t>>
ubs = detail::getUpperBoundStackSizes(asmStr);
EXPECT_TRUE(succeeded(ubs));
// auto upperBounds = maybeUpperBounds.value();
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
// auto upperBounds = maybeUpperBounds.value();

@newling newling force-pushed the stack_size_estimator_3 branch from b9c76d9 to cbfb00d Compare February 21, 2025 01:07
@newling newling enabled auto-merge (squash) February 21, 2025 01:08
@newling newling force-pushed the stack_size_estimator_3 branch from cbfb00d to bb56565 Compare February 21, 2025 01:10
@newling newling merged commit 181e901 into nod-ai:main Feb 21, 2025
7 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants