Skip to content

Commit

Permalink
end_packing_record defaults to 1 for a reason
Browse files Browse the repository at this point in the history
  • Loading branch information
kali committed Dec 13, 2024
1 parent 3eeeea4 commit 0c0573b
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 12 deletions.
2 changes: 1 addition & 1 deletion cli/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -592,7 +592,7 @@ fn handle(matches: clap::ArgMatches, probe: Option<&Probe>) -> TractResult<()> {
for m in tract_linalg::ops().mmm_impls() {
println!("{}", Green.paint(format!(" * {}", m.name())));
for packings in m.packings() {
println!(" - {} • {}", packings.0, packings.1);
println!(" - {:?} • {:?}", packings.0, packings.1);
}
}
println!("{}", White.bold().paint("# MatMul kits"));
Expand Down
25 changes: 14 additions & 11 deletions linalg/src/frame/mmm/pack.rs
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,11 @@ impl Display for PackedFormat {

impl Debug for PackedFormat {
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
write!(f, "Packed{:?}[{}]@{}+{}", self.dt, self.r, self.alignment_bytes, self.end_padding_record)
write!(
f,
"Packed{:?}[{}]@{}+{}",
self.dt, self.r, self.alignment_bytes, self.end_padding_record
)
}
}

Expand Down Expand Up @@ -106,8 +110,10 @@ impl PackedFormat {
let panel_bytes = panel_len * t.datum_type().size_of();
let strides = t.strides();
unsafe {
let mut packed =
Blob::new_for_size_and_align(t.datum_type().size_of() * packed_len, self.alignment_bytes);
let mut packed = Blob::new_for_size_and_align(
t.datum_type().size_of() * packed_len,
self.alignment_bytes,
);
if cfg!(debug_assertions) {
packed.as_bytes_mut().fill(0u8);
}
Expand Down Expand Up @@ -145,8 +151,10 @@ impl PackedFormat {
let panel_bytes = panel_len * t.datum_type().size_of();
let strides = t.strides();
unsafe {
let mut packed =
Blob::new_for_size_and_align(t.datum_type().size_of() * packed_len, self.alignment_bytes);
let mut packed = Blob::new_for_size_and_align(
t.datum_type().size_of() * packed_len,
self.alignment_bytes,
);
if cfg!(debug_assertions) {
packed.as_bytes_mut().fill(0u8);
}
Expand Down Expand Up @@ -520,12 +528,7 @@ pub trait Packing {

impl<D: Datum> Packing for D {
fn packing(r: usize) -> PackedFormat {
PackedFormat {
dt: Self::datum_type(),
r,
alignment_bytes: Self::datum_type().alignment(),
end_padding_record: 0,
}
PackedFormat::new(Self::datum_type(), r, Self::datum_type().alignment())
}
}

Expand Down

0 comments on commit 0c0573b

Please sign in to comment.