Skip to content

Conversation

@shiyunyao
Copy link
Contributor

This PR addresses part of #145 by introducing a centralized header NeuraAttributes.h and replacing a subset of hardcoded magic strings in the lib/ directory.

Copy link
Contributor

@tancheng tancheng left a comment

Choose a reason for hiding this comment

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

Thanks for the cleanup~!

@tancheng tancheng requested a review from HobbitQia January 18, 2026 14:51
@tancheng tancheng linked an issue Jan 18, 2026 that may be closed by this pull request
@tancheng
Copy link
Contributor

Can we also have following in the header file?

// Literals for CONSTANT operations, e.g. "#10" / "#0" / "#3.0".
static std::string getConstantLiteral(Operation *op) {
if (isConstant(op)) {
if (auto value_attr = op->getAttr("value")) {
std::string result = extractConstantLiteralFromAttr(value_attr);
if (!result.empty()) return result;
}
return "#0";
}
// Checks for constant_value attribute in non-CONSTANT operations.
if (auto constant_value_attr = op->getAttr("constant_value")) {
std::string result = extractConstantLiteralFromAttr(constant_value_attr);
if (!result.empty()) return result;
}
// Checks for rhs_value attribute (for binary operations with constant RHS).
if (auto rhs_value_attr = op->getAttr("rhs_value")) {
std::string result = extractConstantLiteralFromAttr(rhs_value_attr);
if (!result.empty()) return result;
}

And anything introduced from https://github.com/coredac/dataflow/pull/157/changes

@shiyunyao
Copy link
Contributor Author

Hi @tancheng, thanks for the suggestions!

I have addressed both points in the latest commits:

  1. Clarified Dataflow/Mapping modes: Added comments as requested (see b209ad1).

  2. Added missing constants: Ported the logic from GenerateCodePass.cpp and added kValue, kConstantValue, kRhsValue, kLhsValue to the header (see 344e97c).

Please verify and resolve the conversation if it looks good.

@tancheng
Copy link
Contributor

Thanks~!

@tancheng tancheng merged commit 76f8c1a into coredac:main Jan 20, 2026
1 check 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.

[P0] Add attributes header file to manage attributes in neura dialects

4 participants