Skip to content

BufferizedNDArray inherits from EagerTensor#394

Open
sreevickrant wants to merge 6 commits into
mainfrom
vick/buff-nd
Open

BufferizedNDArray inherits from EagerTensor#394
sreevickrant wants to merge 6 commits into
mainfrom
vick/buff-nd

Conversation

@sreevickrant
Copy link
Copy Markdown
Collaborator

@sreevickrant sreevickrant commented Apr 30, 2026

@sreevickrant sreevickrant linked an issue Apr 30, 2026 that may be closed by this pull request
@sreevickrant sreevickrant marked this pull request as ready for review April 30, 2026 18:17
Copy link
Copy Markdown
Member

@willow-ahrens willow-ahrens left a comment

Choose a reason for hiding this comment

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

Can bufferizedndarray get moved to be imported after interface? I think it should be imported around the same time we import FIberTensor

@sreevickrant
Copy link
Copy Markdown
Collaborator Author

I was going to ask. I didn't know where to move it so I resorted to update in place.

@willow-ahrens
Copy link
Copy Markdown
Member

Why is count nonzeroes in this pr?

@sreevickrant
Copy link
Copy Markdown
Collaborator Author

sreevickrant commented Apr 30, 2026

tests/test_notation_interpreter.py::test_count_nonfill_vector needs count_non_zeros in EagerTensor. I can revert it back.

@willow-ahrens
Copy link
Copy Markdown
Member

willow-ahrens commented Apr 30, 2026

does it? It looks like it's just asking for np.count_nonzeros. The count_nonfill op is implemented in FinchNotation. I think all that's needed there is to convert a to a ndarray just before we call np.count_nonzeros, is that right?

@sreevickrant
Copy link
Copy Markdown
Collaborator Author

Can bufferizedndarray get moved to be imported after interface? I think it should be imported around the same time we import FIberTensor

I think the problem here is I need to fix dc_stats.py to get rid of the circular import because it uses BufferizedNDArray.

@willow-ahrens
Copy link
Copy Markdown
Member

We're trying to avoid dynamic imports in the library, but I'm not sure what to do about this one.

@sreevickrant
Copy link
Copy Markdown
Collaborator Author

sreevickrant commented Apr 30, 2026

I tried of bunch of stuff but I think this was the cleanest fix. We can always force the linter to not sort init and we can avoid a bunch of the dynamic imports.

@willow-ahrens
Copy link
Copy Markdown
Member

@kylebd99 @mtsokol do you see a way to avoid this dynamic import? The summary is that DCStats uses bufferizedNDArray to accumulate results in finchnotation, but DCStats is defined in autoscheduling module, after the definition of interface. I see two easy fixes:

  1. Embrace chaos and allow relative imports (strongly against but can be convinced)
  2. Define a set of "advanced" autoschedulers after we define interface functions, so that they can reuse the interface functions. This is just moving complex statistics stuff to a different folder that gets loaded after interface gets loaded.

@willow-ahrens
Copy link
Copy Markdown
Member

Is option 2 above a possibility?

@sreevickrant
Copy link
Copy Markdown
Collaborator Author

I agree with option 2. It would also fix the other dynamic import that I had to make:

autoschedule/compiler.py — from ..compile.lower import make_extent inside _lower_query_of_reorder and _lower_query_of_aggregate.

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.

BufferizedNDArray Doesn't Support Matmul

2 participants