Fix ShardLevel Structure#765
Fix ShardLevel Structure#765AdrianGushin wants to merge 71 commits intofinch-tensor:wma/shard_levelsfrom
Conversation
willow-ahrens
left a comment
There was a problem hiding this comment.
Almost there! This is looking great, only small changes requested.
Project.toml
Outdated
| DataStructures = "0.18" | ||
| Distributions = "0.25" | ||
| HDF5 = "0.17" | ||
| InteractiveUtils = "1.11.0" |
There was a problem hiding this comment.
InteractiveUtils shouldn't be a Finch dep, we need to remove before merging.
Project.toml
Outdated
| NPZ = "15e1cf62-19b3-5cfa-8e77-841668bca605" | ||
| SparseArrays = "2f01184e-e22b-5df5-ae63-d93ebab69eaf" | ||
| TensorMarket = "8b7d4fe7-0b45-4d0d-9dd8-5cc9b23b4b77" No newline at end of file | ||
| TensorMarket = "8b7d4fe7-0b45-4d0d-9dd8-5cc9b23b4b77" |
There was a problem hiding this comment.
Tensor market should be a test dep, but I don't think it's an extra right? do we need to move it to the test project.toml?
src/architecture.jl
Outdated
| @@ -1,8 +1,10 @@ | |||
| using InteractiveUtils | |||
There was a problem hiding this comment.
let's remove this, it was just for debugging
src/architecture.jl
Outdated
|
|
||
| A datatype representing a device on which tasks can be executed. | ||
| """ | ||
|
|
There was a problem hiding this comment.
does this like break the documentation for abstract device?
src/architecture.jl
Outdated
| end, | ||
| ) | ||
| VirtualCPU(value(n, Int)) | ||
| VirtualCPU(value(n, Int), literal(id)) |
There was a problem hiding this comment.
it's also okay to just use id without wrapping as literal, as long as you wrap it when needed. whatever's convenient
src/architecture.jl
Outdated
| FinchNotation.finch_leaf(mem::VirtualCPULocalMemory) = virtual(mem) | ||
| function virtualize(ctx, ex, ::Type{CPULocalMemory}) | ||
| VirtualCPULocalMemory(virtualize(ctx, :($ex.device), CPU)) | ||
| function virtualize(ctx, ex, ::Type{CPULocalMemory{id}}) where {id} |
There was a problem hiding this comment.
instead of keying CPULocalMemory on id, let's put the whole CPU type in the type parameter so that further changes to CPU parameterization don't need to affect the localmem
There was a problem hiding this comment.
then we can recursively virtualize the cpu
src/architecture.jl
Outdated
| global_memory(device::CPU) = CPUSharedMemory(device) | ||
| local_memory(device::CPU{id}) where {id} = CPULocalMemory{id}(device) | ||
| shared_memory(device::CPU{id}) where {id} = CPUSharedMemory{id}(device) | ||
| global_memory(device::CPU{id}) where {id} = CPUSharedMemory{id}(device) |
There was a problem hiding this comment.
same thing here, I think it makes more sense to key on the CPU than the ID. feel free to disagree here.
src/tensors/levels/shard_levels.jl
Outdated
| function transfer(task::MemoryChannel, arr::MultiChannelBuffer) | ||
| if task.device == arr.device | ||
| temp = arr.data[task.t] | ||
| @assert isa(temp, Vector) |
There was a problem hiding this comment.
This is good for debugging, but I don't think this will always be the case, we might have different buffer types than vector
|
|
||
| @testset "Finch" begin | ||
| include("modules/checkoutput_testsetup.jl") | ||
| include("suites/constructors_tests.jl") |
There was a problem hiding this comment.
wow. It's crazy that this wasn't already included
| end | ||
|
|
||
| @test C[4,4] == 12 | ||
| end |
There was a problem hiding this comment.
Good test! Let's also add a test in perhaps representation.jl which generates some reference output for a shard level kernel
|
We can merge this to main once we have some more tests. |
willow-ahrens
left a comment
There was a problem hiding this comment.
Hi Adrian! This all looks good, the only requirement we need now is a test which calls check_output to compare the generated shardlevel code against a reference output. See elsewhere in the code where this function is used for examples. You'll need to follow instructions in the contributing guide to generate new 64-bit reference, and run the "fixbot" action to generate new 32-bit reference
|
I've added you to the repo as a collaborator, you can re-open the PR using finch-tensor as the remote and it will automatically run tests. |
Codecov Report❌ Patch coverage is
🚀 New features to boost your workflow:
|
willow-ahrens
left a comment
There was a problem hiding this comment.
A summary of failing tests and next steps to merge this:
- Windows tests are failing because we need to run fixbot (Contributing.md)
- Ubuntu latest is failing for unrelated reasons (my bad, julia 1.12.3 is much stricter)
- I'd like to see the CPU tagging and SparseDict, etc. fixes split out and merged to main first.
I'll leave 1 to you. I'll work on solving 2 asap. I won't be able to get to 3 until sometime tomorrow evening, feel free to do that earlier! I use "gitlens search & compare" vscode extension for stuff like that.
| - uses: actions/checkout@v3 | ||
| with: | ||
| token: ${{ secrets.WILLOW_BOT_TOKEN }} | ||
| token: ${{ secrets.ADRIAN_BOT_TOKEN }} |
There was a problem hiding this comment.
You must have run this from your fork. If the willow_bot_token is not working, I should fix that rather than you using your own token on your fork, so that others can also trigger the action from the actions pane without generating their own tokens. I have verified you have write permissions, so in the future, if you make this a branch on the finch-tensor/Finch.jl repo, you should be able to manually run FixBot on this branch from the actions tab without changing this secret.
This pull request adds some fixes for the ShardLevel structure and adds associated test cases. It also updates the CPU struct to facilitate multiple distinct cores.