Skip to content

memory: make buffers aligned to CACHE_LINE_SIZE - #1568

Merged
lgirdwood merged 5 commits into
thesofproject:masterfrom
abonislawski:linker_buf_cache_align
Jun 18, 2019
Merged

lgirdwood merged 5 commits into
thesofproject:masterfrom
abonislawski:linker_buf_cache_align

Conversation

@abonislawski

Copy link
Copy Markdown
Member

As adviced in PR #1557 it provides better memory/cache performance since it aligns with memory IO burst size and cache line size

This PR will use CACHE_LINE_SIZE in CNL, ICL and SUE

Comment thread src/platform/cannonlake/cannonlake.x.in Outdated

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Please use PLATFORM_DCACHE_ALIGN.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

@tlauda currently not possible, we cannot include sof/platform.h to linker and the value of PLATFORM_DCACHE_ALIGN can be "sizeof(uint32_t)" which will not work in linker.

If we want to use it then we need to move it to another file and remove sizeof possibility

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 is platform specific linker script, not a universal one, so I'm fine with some HEAP_BUF_ALIGNMENT define in some common cAVS header file included by the linker script and also in another place followed by some C_ASSERT(0 == (HEAP_BUF_ALIGNMENT % PLATFORM_DCACHE_ALIGN)).

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

@tlauda @mmaka1 added HEAP_BUF_ALIGNMENT with static_assert for it.
Done in cAVS memory.h and memory.c, please check if this is a correct place for them

This value will determine alignment for heap buffers

Signed-off-by: Adrian Bonislawski <adrian.bonislawski@linux.intel.com>
@abonislawski
abonislawski force-pushed the linker_buf_cache_align branch from e1ad052 to e0d8348 Compare June 17, 2019 10:49
@jajanusz
jajanusz requested a review from tlauda June 17, 2019 12:42

@lgirdwood lgirdwood left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

commit message and please comment what this check does in the code.

This will check if heap buffers alignment is valid

Signed-off-by: Adrian Bonislawski <adrian.bonislawski@linux.intel.com>
It provides better memory/cache performance since it aligns with memory IO burst size and cache line size

Signed-off-by: Adrian Bonislawski <adrian.bonislawski@linux.intel.com>
It provides better memory/cache performance since it aligns with memory IO burst size and cache line size

Signed-off-by: Adrian Bonislawski <adrian.bonislawski@linux.intel.com>
@abonislawski
abonislawski force-pushed the linker_buf_cache_align branch from e0d8348 to 426edaa Compare June 18, 2019 07:39
@abonislawski

Copy link
Copy Markdown
Member Author

commit message and please comment what this check does in the code.

done

It provides better memory/cache performance since it aligns with memory IO burst size and cache line size

Signed-off-by: Adrian Bonislawski <adrian.bonislawski@linux.intel.com>
@abonislawski
abonislawski force-pushed the linker_buf_cache_align branch from 426edaa to 741b9ff Compare June 18, 2019 12:10
@abonislawski

Copy link
Copy Markdown
Member Author

No changes, just force-pushed to trigger travis again

@abonislawski

Copy link
Copy Markdown
Member Author

@lgirdwood please finish review. We need it for #1557 which is needed for #1567 :)

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.

5 participants