Skip to content

Issue 1 sparse zero write lifecycle - #5

Open
aliaksandr-vasilenka-vention wants to merge 37 commits into
issue-1-impl-tensor-access-logicfrom
issue-1-sparse-zero-write-lifecycle
Open

Issue 1 sparse zero write lifecycle#5
aliaksandr-vasilenka-vention wants to merge 37 commits into
issue-1-impl-tensor-access-logicfrom
issue-1-sparse-zero-write-lifecycle

Conversation

@aliaksandr-vasilenka-vention

Copy link
Copy Markdown
Collaborator
  • Separates Tensors into Dense and Sparse, only places for branching are create and load
  • Adds tests for Sparse-zero policy cases
  • Implements Sparse-zero policy cases
  • Fixes incorrect read value logic when block is missing and index is present for Sparse tensor to follow close fail path

Comment thread src/stream.rs Outdated
Comment thread src/stream.rs Outdated
Comment thread src/lib.rs Outdated
Comment thread src/lib.rs Outdated
self.write_block(block_id, block).await
}

async fn delete_block(&self, block_id: u64) {

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

How do we handle the case where the entries in a sparse tensor (the blocks) are larger than the configured block size for a dense tensor? We should not support "unlimited block size" in any case

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

Not sure what part of code is referenced here. Could you please clarify?

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

This is more of an architectural question. Say the block size is 4096 elements. A user creates a sparse tensor of shape [1000, 1000, 64, 64, 64] where axis 1 is the sparse axis. That means each entry on the sparse axis must be represented using multiple blocks on the filesystem (not just one per entry). Is this handled correctly now or is this something we need to address as a follow-up?

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

Need to check it out

Comment thread src/lib.rs Outdated
Comment thread src/lib.rs Outdated
Comment thread src/lib.rs Outdated
Comment thread src/stream.rs
Comment thread src/lib.rs Outdated
Comment thread src/schema.rs Outdated
Comment thread src/stream.rs Outdated
Comment thread src/stream.rs Outdated
Comment thread src/stream.rs Outdated
Comment thread src/stream.rs Outdated
Comment thread src/stream.rs Outdated
@aliaksandr-vasilenka-vention

aliaksandr-vasilenka-vention commented Jul 28, 2026

Copy link
Copy Markdown
Collaborator Author

To be noted:

  1. For some reasons freqfs lib allows to read values for tensor even if directory with blocks for that tensor is removed physically, is it normal behaviour for freqfs or should we check it out?
  2. Should we address the missing decoding logic for Result in destream lib and encoding looks like inner values encoding?
  3. Currently attempt to write 0 into sparse tensor removes row inside the index and also removes block only if it empty. Is it correct?

@haydnv haydnv left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Much better! Consider a type alias for Shape and Coord, for clarity and performance:

type Coord = SmallVec<[u64; 8]>;
type Shape = SmallVec<[u64; 8]>;

Comment thread src/lib.rs
Comment thread src/lib.rs Outdated
@haydnv

haydnv commented Jul 30, 2026

Copy link
Copy Markdown
Collaborator
  1. Yes freqfs is designed to prefer an in-memory cache and fall back to disk storage only to avoid an OOM error
  2. Why do we need this?
  3. Yes this is correct

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.

2 participants