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

i#7291: support large pages in TLB #7292

Open
wants to merge 12 commits into
base: master
Choose a base branch
from
Open

Conversation

oralmer
Copy link
Contributor

@oralmer oralmer commented Feb 20, 2025

Changed block_size to long int in order to allow larger pages in TLB. Also added two minor fixes that came up while working on the feature:

  • Argument name mismatches in cache_lru_t and cache_fifo_t between the header and body.
  • Clearer error messages in tlb_simulator_t, so you can know exactly what failed to build.

Fixes #7291

Changed `block_size` to `long int` in order to allow larger pages in
TLB. Also added two minor fixes that came up while working on the
feature:
 - Argument name mismatches in `cache_lru_t` and `cache_fifo_t`
between the header and body.
 - Clearer error messages in `tlb_simulator_t`, so you can know
exactly what failed to build.

Fixes #7291
@@ -74,7 +74,7 @@ caching_device_t::~caching_device_t()
}

bool
caching_device_t::init(int associativity, int block_size, int num_blocks,
caching_device_t::init(int associativity, long int block_size, int num_blocks,
Copy link
Contributor

Choose a reason for hiding this comment

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

Should we widen num_blocks while at it or we are certain 32-bit is plenty?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

for my current needs it's enough, but I do think we can have a conversation about this. IMO:

uint64_t associativity   // describes the size of a data structure
uint8_t lg2_block_size // we only allow powers of 2 and only use this int to calc log2
uint64_t num_blocks   // describes the size of a data structure
uint64_t total_size       // in cache_t

but these changes would lead to an interface change, that I'd probably like to avoid. we can also change the ints to int64_t and leave it at that, any fixes from this change will be very simple. WDYT?

Copy link
Contributor

Choose a reason for hiding this comment

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

@brettcoon any opinions here?

Copy link
Contributor

Choose a reason for hiding this comment

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

I favor signed over unsigned except when unsigned is explicitly needed (e.g. bitmasks). I'm not sure why anybody needs 64 bits for associativity, but I do agree that 64 bits seems appropriate for block_size, num_blocks, and total_size. So I like int64_t for those three.

@derekbruening
Copy link
Contributor

Note that this Alpine job broke separately and is now fixed in PR #7289.

@oralmer oralmer changed the title i7291: support large pages in TLB i#7291: support large pages in TLB Feb 23, 2025
Samll fixes which were not enough to justify a seperate issue.
 - Fixed inconsistent argument names in cache_fifo and cach_lru - header
   vs implementation.
 - Improved error printing in tlb_t so you can know what actually failed
 - Added and `add_parent` method to `caching_device_t`
@oralmer oralmer changed the base branch from master to i0-cleanups-and-fixes February 26, 2025 07:34
Base automatically changed from i0-cleanups-and-fixes to master February 27, 2025 08:36
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.

Support Pages Above Size 2^32 in TLB
3 participants