Skip to content

Scratchpad memrefs incorrectly aligned to 64 bytes. #141

@EmilySillars

Description

@EmilySillars

By default, allocOps have their getAlignment() field set to 64 bytes due to most CPUs having a cache line size of 64 bytes.

Because snitch uses a scratchpad, we only needs align to the memref's element size.

In LowerAllocations.cpp here,
The following lines

uint64_t bitWidth = memRefType.getElementTypeBitWidth();
if (std::optional<uint64_t> alignment = allocOp.getAlignment())
      offset = llvm::alignTo(offset, *alignment);
else
      offset = llvm::alignTo(offset, llvm::divideCeil(bitWidth, 8));

should be replaced with

offset = llvm::alignTo(offset, llvm::divideCeil(bitWidth, 8));

Relevant Zulip conversation: #Convolve > xDSL Interpreter Cost Model @ 💬

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions