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

[RTG] Add context resource attribute interface #8034

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

maerhart
Copy link
Member

@maerhart maerhart commented Jan 6, 2025

Provides a way to specify context resources with an attribute that works well in combination with the ContextResourceTypeInterface. Currently, the cpu_decl operation has an index attr but returns a ContextResourceTypeInterface type, which makes folding difficult (and thus declaring it ConstantLike).
Further down the line, we could consider removing the ContextResourceOpInterface in favour of a single op in the RTG dialect.

@maerhart maerhart added the RTG Involving the `rtg` dialect label Jan 6, 2025
@maerhart maerhart requested a review from darthscsi January 6, 2025 12:50
@maerhart maerhart force-pushed the maerhart-rtg-contextresourceattr branch from 8c00f89 to d439b8c Compare January 6, 2025 13:02
@maerhart maerhart force-pushed the maerhart-rtg-contextresourceattr branch from d439b8c to bb10af0 Compare January 6, 2025 17:12
Comment on lines +42 to +43
.def_property_readonly(
"id", [](MlirAttribute self) { return rtgtestCPUAttrGetId(self); });
Copy link
Member Author

Choose a reason for hiding this comment

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

Needs a test

Comment on lines +38 to +46
/// If the type is an RTGTest CPUAttr.
MLIR_CAPI_EXPORTED bool rtgtestAttrIsACPU(MlirAttribute attr);

/// Creates an RTGTest CPU attribute in the context.
MLIR_CAPI_EXPORTED MlirAttribute rtgtestCPUAttrGet(MlirContext ctxt,
unsigned id);

/// Returns the core ID represented by the CPU attribute.
MLIR_CAPI_EXPORTED unsigned rtgtestCPUAttrGetId(MlirAttribute attr);
Copy link
Member Author

Choose a reason for hiding this comment

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

Needs tests

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
RTG Involving the `rtg` dialect
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant