-
Notifications
You must be signed in to change notification settings - Fork 26
Tpush #115
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
azizbek-khabibov
wants to merge
10
commits into
hw-native-sys:main
Choose a base branch
from
azizbek-khabibov:tput
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Tpush #115
Changes from all commits
Commits
Show all changes
10 commits
Select commit
Hold shift + click to select a range
87d8f23
fix
3be1626
add logs
f3d0c7b
fixed
a2c87cd
Finally
f490482
reproduced error
749a106
reproduced issue
c7393dc
fixed
91e31d3
temp fix for 3 tests
f0769ea
fix
9758331
real fix"
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -46,7 +46,7 @@ enum class TransferDir : uint8_t | |
| template <typename TileProd> | ||
| PTO_INTERNAL constexpr bool IsC2VProducerTile() | ||
| { | ||
| return TileProd::Loc == TileType::Acc; | ||
| return TileProd::Loc == TileType::Acc || TileProd::Loc == TileType::Mat; | ||
| } | ||
|
|
||
| template <typename TileProd> | ||
|
|
@@ -693,14 +693,14 @@ struct TPipe { | |
| if (fifo.GM_SLOT_BUFFER != nullptr) { | ||
| popTileFromGMFiFo<TileCons, Split>(fifo, tile); | ||
| return true; | ||
| } else if constexpr (TPipe::is_c2v) { | ||
| } else if constexpr (TPipe::is_c2v && TileCons::Loc == TileType::Vec) { // && TileCons::Loc != TileType::Vec | ||
| if constexpr (Split == TileSplitAxis::TILE_NO_SPLIT) { | ||
| popTileFromVecFiFo<TileCons, Split>(fifo, tile); | ||
| popTileFromVecFiFoSplit<TileCons, Split>(fifo, tile); // popTileFromVecFiFoSplit | ||
| } else { | ||
| popTileFromVecFiFoSplit<TileCons, Split>(fifo, tile); | ||
| } | ||
| return false; | ||
| } else if constexpr (TPipe::is_v2c) { | ||
| } else if constexpr (TPipe::is_v2c && TileCons::Loc != TileType::Vec) { // && TileCons::Loc == TileType::Vec | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. |
||
| popTileFromMatFiFo<TileCons, Split>(fifo, tile); | ||
| return false; | ||
| } | ||
|
|
@@ -728,10 +728,18 @@ PTO_INTERNAL void TPush_c2v(Pipe &pipe, TileProd &tile, size_t entryBase, size_t | |
| (Split == TileSplitAxis::TILE_LEFT_RIGHT) ? (TileProd::Cols / 2) : static_cast<int>(TileProd::Cols); | ||
|
|
||
| if constexpr (Split == TileSplitAxis::TILE_NO_SPLIT) { | ||
| using SlotTile = Tile<TileType::Vec, T, consRows, consCols, BLayout::RowMajor, consRows, consCols>; | ||
| SlotTile slotTile; | ||
| TASSIGN(slotTile, static_cast<uint64_t>(pipe.fifo.C2V_CONSUMER_BUF + entryBase)); | ||
| cpu_pipe::CopyTileWindow(slotTile, tile, 0, 0); | ||
| // using SlotTile = Tile<TileType::Vec, T, consRows, consCols, BLayout::RowMajor, consRows, consCols>; | ||
| // SlotTile slotTile; | ||
| // TASSIGN(slotTile, static_cast<uint64_t>(pipe.fifo.C2V_CONSUMER_BUF + entryBase)); | ||
| // cpu_pipe::CopyTileWindow(slotTile, tile, 0, 0); | ||
|
Comment on lines
+731
to
+734
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. |
||
| auto &slotStorage = Pipe::GetSharedState().local_slot_storage[slotIndex]; | ||
| for (uint32_t splitIndex = 0; splitIndex < cpu_pipe::GetSplitCount<Split>(); ++splitIndex) { | ||
| auto *slotPtr = reinterpret_cast<T *>(slotStorage.data() + splitIndex * Pipe::RingFiFo::SLOT_SIZE + | ||
| pipe.prod.entryOffset); | ||
| const uint32_t rowOffset = (Split == TileSplitAxis::TILE_UP_DOWN) ? splitIndex * consRows : 0; | ||
| const uint32_t colOffset = (Split == TileSplitAxis::TILE_LEFT_RIGHT) ? splitIndex * consCols : 0; | ||
| cpu_pipe::CopyTileWindowToLinear(slotPtr, consCols, tile, consRows, rowOffset, colOffset); | ||
| } | ||
| } else { | ||
| auto &slotStorage = Pipe::GetSharedState().local_slot_storage[slotIndex]; | ||
| for (uint32_t splitIndex = 0; splitIndex < cpu_pipe::GetSplitCount<Split>(); ++splitIndex) { | ||
|
|
@@ -795,15 +803,15 @@ PTO_INTERNAL void TPUSH_IMPL(Pipe &pipe, TileProd &tile) | |
| TSTORE(globalData, tile); | ||
| } else { | ||
| using GlobalData = GlobalTensor<T, Shape<1, 1, 1, rows, cols>, Stride<1, 1, 1, cols, 1>>; | ||
| auto *addr = | ||
| auto *addr = | ||
| reinterpret_cast<__gm__ T *>(reinterpret_cast<std::uintptr_t>(pipe.fifo.GM_SLOT_BUFFER) + entryBase); | ||
| GlobalData globalData(addr); | ||
| TSTORE(globalData, tile); | ||
| } | ||
| } else if constexpr (Pipe::is_c2v) { | ||
| TPush_c2v<Pipe, TileProd, Split>(pipe, tile, entryBase, slotIndex); | ||
| } else if constexpr (Pipe::is_v2c) { | ||
| } else if constexpr (Pipe::is_v2c && TileProd::Loc == TileType::Vec) { | ||
| TPush_v2c<Pipe, TileProd, Split>(pipe, tile, entryBase); | ||
| } else if constexpr (Pipe::is_c2v && TileProd::Loc != TileType::Vec) { | ||
| TPush_c2v<Pipe, TileProd, Split>(pipe, tile, entryBase, slotIndex); | ||
| } | ||
| if (pipe.prod.getRecordStatus()) { | ||
| pipe.prod.template record<TileProd, Split>(); | ||
|
|
||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -37,120 +37,122 @@ endfunction() | |
| find_package(Threads REQUIRED) | ||
|
|
||
| set(ALL_TESTCASES | ||
| hashfind | ||
| mgather | ||
| mscatter | ||
| setgetval | ||
| tabs | ||
| tadd | ||
| taddc | ||
| tadds | ||
| taddsc | ||
| tassign_alias | ||
| tand | ||
| tands | ||
| targreduceop | ||
| taxpy | ||
| tbroadcast | ||
| tci | ||
| tcmp | ||
| tcmps | ||
| tcolexpand | ||
| tcolexpandop | ||
| tcolmax | ||
| tcolmin | ||
| tcolprod | ||
| tcolreduceidx | ||
| tcolsum | ||
| tconcat | ||
| tcvt | ||
| tdequant | ||
| tdiv | ||
| tdivs | ||
| texp | ||
| texpands | ||
| textract | ||
| tfillpad | ||
| tflashattn | ||
| tfmod | ||
| tfmods | ||
| tgather | ||
| tgatherb | ||
| tget | ||
| tget_async | ||
| tget_scale_addr | ||
| tgetscaleaddr | ||
| thistogram | ||
| timg2col | ||
| tinsert | ||
| tload | ||
| tloadconv | ||
| tlog | ||
| tlrelu | ||
| tmatmul | ||
| tmatmul_layout | ||
| #tmatmul_mx | ||
| tmax | ||
| tmaxs | ||
| tmin | ||
| tmins | ||
| tmov | ||
| tmrgsort | ||
| tmul | ||
| tmuls | ||
| tneg | ||
| tnot | ||
| tnotify | ||
| tor | ||
| tors | ||
| tpartadd | ||
| tpartmul | ||
| tpartmax | ||
| tpartmin | ||
| tprefetch | ||
| tprelu | ||
| tpushpop | ||
| tput | ||
| tput_async | ||
| tquant | ||
| trandom | ||
| trecip | ||
| treduce | ||
| trelu | ||
| trem | ||
| trems | ||
| treshape | ||
| trowexpand | ||
| trowexpandop | ||
| trowmax | ||
| trowmin | ||
| trowreduceidx | ||
| trowsum | ||
| trsqrt | ||
| tscatter | ||
| tsel | ||
| tsels | ||
| tshl | ||
| tshls | ||
| tshr | ||
| tshrs | ||
| tsort32 | ||
| tsqrt | ||
| tstore | ||
| tsub | ||
| tsubview | ||
| tsubc | ||
| tsubs | ||
| tsubsc | ||
| ttest | ||
| ttrans | ||
| ttri | ||
| twait | ||
| txor | ||
| txors | ||
| tpushpop_cv_nosplit | ||
| tpushpop_cv | ||
| tpushpop_vc_nosplit | ||
| # hashfind | ||
| # mgather | ||
| # mscatter | ||
| # setgetval | ||
| # tabs | ||
| # tadd | ||
| # taddc | ||
| # tadds | ||
| # taddsc | ||
| # tassign_alias | ||
| # tand | ||
| # tands | ||
| # targreduceop | ||
| # taxpy | ||
| # tbroadcast | ||
| # tci | ||
| # tcmp | ||
| # tcmps | ||
| # tcolexpand | ||
| # tcolexpandop | ||
| # tcolmax | ||
| # tcolmin | ||
| # tcolprod | ||
| # tcolreduceidx | ||
| # tcolsum | ||
| # tconcat | ||
| # tcvt | ||
| # tdequant | ||
| # tdiv | ||
| # tdivs | ||
| # texp | ||
| # texpands | ||
| # textract | ||
| # tfillpad | ||
| # tflashattn | ||
| # tfmod | ||
| # tfmods | ||
| # tgather | ||
| # tgatherb | ||
| # tget | ||
| # tget_async | ||
| # tget_scale_addr | ||
| # tgetscaleaddr | ||
| # thistogram | ||
| # timg2col | ||
| # tinsert | ||
| # tload | ||
| # tloadconv | ||
| # tlog | ||
| # tlrelu | ||
| # tmatmul | ||
| # tmatmul_layout | ||
| # #tmatmul_mx | ||
| # tmax | ||
| # tmaxs | ||
| # tmin | ||
| # tmins | ||
| # tmov | ||
| # tmrgsort | ||
| # tmul | ||
| # tmuls | ||
| # tneg | ||
| # tnot | ||
| # tnotify | ||
| # tor | ||
| # tors | ||
| # tpartadd | ||
| # tpartmul | ||
| # tpartmax | ||
| # tpartmin | ||
| # tprefetch | ||
| # tprelu | ||
| # tpushpop | ||
| # tput | ||
| # tput_async | ||
| # tquant | ||
| # trandom | ||
| # trecip | ||
| # treduce | ||
| # trelu | ||
| # trem | ||
| # trems | ||
| # treshape | ||
| # trowexpand | ||
| # trowexpandop | ||
| # trowmax | ||
| # trowmin | ||
| # trowreduceidx | ||
| # trowsum | ||
| # trsqrt | ||
| # tscatter | ||
| # tsel | ||
| # tsels | ||
| # tshl | ||
| # tshls | ||
| # tshr | ||
| # tshrs | ||
| # tsort32 | ||
| # tsqrt | ||
| # tstore | ||
| # tsub | ||
| # tsubview | ||
| # tsubc | ||
| # tsubs | ||
| # tsubsc | ||
| # ttest | ||
| # ttrans | ||
| # ttri | ||
| # twait | ||
| # txor | ||
| # txors | ||
| # tpushpop_cv_nosplit | ||
| # tpushpop_cv | ||
| # tpushpop_vc_nosplit | ||
|
Comment on lines
+40
to
+153
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. |
||
| tpush_a3 | ||
| tpush_a5 | ||
| ) | ||
|
|
||
| foreach(TESTCASE ${ALL_TESTCASES}) | ||
|
|
||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1 @@ | ||
| pto_cpu_sim_st(tpush_a3) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,27 @@ | ||
| #!/usr/bin/env python3 | ||
| import numpy as np | ||
| import os | ||
|
|
||
| # Generate random inputs | ||
| a = np.random.randn(32, 64).astype(np.float32) | ||
| b = np.random.randn(64, 512).astype(np.float32) | ||
| c_prev = np.random.randn(32, 512).astype(np.float32) | ||
|
|
||
| # Compute golden output: c = c_prev + matmul(a + 1, b) | ||
| c_golden = c_prev + np.matmul(a + 1.0, b) | ||
|
|
||
| # Save as raw binary files | ||
|
|
||
|
|
||
| case_name = "TPUSH_A3Test.case_1" | ||
| if not os.path.exists(case_name): | ||
| os.makedirs(case_name) | ||
| original_dir = os.getcwd() | ||
| os.chdir(case_name) | ||
|
|
||
| a.tofile("a.bin") | ||
| b.tofile("b.bin") | ||
| c_prev.tofile("c.bin") | ||
| c_golden.tofile("golden.bin") | ||
|
|
||
| os.chdir(original_dir) |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The trailing comment is confusing and should be removed.