Skip to content

target/riscv: implement abstract command cache#1235

Merged
en-sc merged 1 commit into
riscv-collab:riscvfrom
fkhaidari:fk-sc/abstract-cmd-cache
Mar 28, 2025
Merged

target/riscv: implement abstract command cache#1235
en-sc merged 1 commit into
riscv-collab:riscvfrom
fkhaidari:fk-sc/abstract-cmd-cache

Conversation

@fkhaidari
Copy link
Copy Markdown
Contributor

Implemented cache of unsupported abstract commands. It's purpose is to replace set of caching variables to one. So this commit provides one ac_not_supported_cache instead of abstract_read_csr_supported,
abstract_write_csr_supported, abstract_read_fpr_supported, abstract_write_fpr_supported, has_aampostincrement.

Dropped check for buggy aampostincrement

Fixes #1232

Change-Id: I75cae1481841f2cd0393d6cc80f0d913fbe34294

@fkhaidari fkhaidari force-pushed the fk-sc/abstract-cmd-cache branch from 5b975e0 to cc7e5e3 Compare March 4, 2025 08:50
@fkhaidari
Copy link
Copy Markdown
Contributor Author

@JanMatCodasip, @MarekVCodasip, could you please take a look?

Copy link
Copy Markdown
Collaborator

@JanMatCodasip JanMatCodasip left a comment

Choose a reason for hiding this comment

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

Thank you for this improvement. Overall, the code looks all right. I have found several things to address, though. Could you please check my comments.

Comment thread src/target/riscv/riscv-013.c
Comment thread src/target/riscv/riscv-013.c Outdated
Comment thread src/target/riscv/riscv-013.c Outdated
Comment thread src/target/riscv/riscv-013.c Outdated
Comment thread src/target/riscv/riscv-013.c Outdated
Comment thread src/target/riscv/riscv-013.c Outdated
Comment thread src/target/riscv/riscv-013.c Outdated
Comment thread src/target/riscv/riscv-013.c Outdated
@fkhaidari fkhaidari force-pushed the fk-sc/abstract-cmd-cache branch 2 times, most recently from 13ade68 to 0267349 Compare March 15, 2025 12:54
@fkhaidari fkhaidari requested a review from JanMatCodasip March 15, 2025 12:56
@fkhaidari fkhaidari force-pushed the fk-sc/abstract-cmd-cache branch from 0267349 to 272c514 Compare March 18, 2025 12:24
Copy link
Copy Markdown
Collaborator

@JanMatCodasip JanMatCodasip left a comment

Choose a reason for hiding this comment

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

@fk-sc thank you for addressing the findings so far.

I came across few more things - if you can please look at them.

Comment thread src/target/riscv/riscv-013.c Outdated
Comment thread src/target/riscv/riscv-013.c Outdated
Comment thread src/target/riscv/riscv-013.c Outdated
Comment thread src/target/riscv/riscv-013.c Outdated
Comment thread src/target/riscv/riscv-013.c Outdated
Comment thread src/target/riscv/riscv-013.c Outdated
@fkhaidari fkhaidari force-pushed the fk-sc/abstract-cmd-cache branch from 272c514 to 4e0f011 Compare March 19, 2025 10:54
@fkhaidari fkhaidari requested a review from JanMatCodasip March 19, 2025 11:03
@fkhaidari fkhaidari force-pushed the fk-sc/abstract-cmd-cache branch 2 times, most recently from 946330b to ff8bb84 Compare March 19, 2025 12:27
Copy link
Copy Markdown
Collaborator

@JanMatCodasip JanMatCodasip left a comment

Choose a reason for hiding this comment

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

Overall this MR looks good. I will do one last proper review tomorrow.

Comment thread src/target/riscv/riscv-013.c Outdated
Comment thread src/target/riscv/riscv-013.c Outdated
@fkhaidari fkhaidari force-pushed the fk-sc/abstract-cmd-cache branch from ff8bb84 to 6bd4a06 Compare March 19, 2025 15:49
@fkhaidari fkhaidari requested a review from JanMatCodasip March 19, 2025 15:51
Copy link
Copy Markdown
Collaborator

@JanMatCodasip JanMatCodasip left a comment

Choose a reason for hiding this comment

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

Overall, this looks fine. I am sending my last batch of comments, mostly it is minor coding stuff.

I do not expect to have any more comments than that.

Comment thread src/target/riscv/riscv-013.c Outdated
Comment thread src/target/riscv/riscv-013.c Outdated
Comment thread src/target/riscv/riscv-013.c Outdated
Comment thread src/target/riscv/riscv-013.c Outdated
Comment thread src/target/riscv/riscv-013.c Outdated
Comment thread src/target/riscv/riscv-013.c Outdated
Comment thread src/target/riscv/riscv-013.c Outdated
Comment thread src/target/riscv/riscv-013.c Outdated
Comment thread src/target/riscv/riscv-013.c Outdated
Comment thread src/target/riscv/riscv-013.c Outdated
@fkhaidari fkhaidari force-pushed the fk-sc/abstract-cmd-cache branch 3 times, most recently from e7ae250 to a7b5f42 Compare March 24, 2025 08:52
JanMatCodasip
JanMatCodasip previously approved these changes Mar 24, 2025
Copy link
Copy Markdown
Collaborator

@JanMatCodasip JanMatCodasip left a comment

Choose a reason for hiding this comment

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

LGTM, thank you.

Comment thread src/target/riscv/riscv-013.c
JanMatCodasip
JanMatCodasip previously approved these changes Mar 24, 2025
Copy link
Copy Markdown
Collaborator

@en-sc en-sc left a comment

Choose a reason for hiding this comment

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

@JanMatCodasip, @fk-sc, I've re-opened some of the discussions.
IMHO, the suggested improvement to abstract memory accesses should not be implemented in the same commit. Please, take a look.

@fkhaidari fkhaidari force-pushed the fk-sc/abstract-cmd-cache branch from a31a57f to bf43598 Compare March 25, 2025 10:16
…nsupported abstract commands. It's purpose is to replace set of caching variables to one. So this commit provides one ac_not_supported_cache instead of abstract_read_csr_supported, abstract_write_csr_supported, abstract_read_fpr_supported, abstract_write_fpr_supported, has_aampostincrement.

Dropped check for buggy aampostincrement

Fixes riscv-collab#1232

Change-Id: I9690d9d79e3d1f593b63740b989074dcf0285637
Signed-off-by: Farid Khaydari <f.khaydari@syntacore.com>
@fkhaidari fkhaidari force-pushed the fk-sc/abstract-cmd-cache branch from bf43598 to ab97974 Compare March 25, 2025 10:24
@fkhaidari fkhaidari requested a review from en-sc March 25, 2025 12:15
@en-sc en-sc merged commit b064830 into riscv-collab:riscv Mar 28, 2025

static bool ac_cache_contains(const struct ac_cache *cache, uint32_t command)
{
return bsearch(&command, cache->commands, cache->size,
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

this MR actually adds a subtle UB , according to ubsan. cache->commands may be NULL (when cache>size == 0)

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

MR with the fix: #1297

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.

Implement generic abstract command support cache

4 participants