-
Notifications
You must be signed in to change notification settings - Fork 194
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
optimize by adding pipeline and multi-thread conversion
- Loading branch information
Ubuntu
committed
Jul 7, 2024
1 parent
0e81887
commit acd9a42
Showing
11 changed files
with
205 additions
and
103 deletions.
There are no files selected for viewing
This file contains 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
This file contains 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
This file contains 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
This file contains 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
This file contains 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 @@ | ||
package gpu | ||
|
||
import ( | ||
"fmt" | ||
|
||
"github.com/ingonyama-zk/icicle/v2/wrappers/golang/core" | ||
cr "github.com/ingonyama-zk/icicle/v2/wrappers/golang/cuda_runtime" | ||
bn254_icicle "github.com/ingonyama-zk/icicle/v2/wrappers/golang/curves/bn254" | ||
"github.com/ingonyama-zk/icicle/v2/wrappers/golang/curves/bn254/vecOps" | ||
) | ||
|
||
// numRow and numCol describes input dimension | ||
func Transpose(coeffStoreFFT core.HostSlice[bn254_icicle.ScalarField], l, numPoly, numCol int) (core.HostSlice[bn254_icicle.ScalarField], error) { | ||
totalSize := l * numPoly * numCol | ||
ctx, err := cr.GetDefaultDeviceContext() | ||
if err != cr.CudaSuccess { | ||
return nil, fmt.Errorf("allocating bytes on device for projective results failed") | ||
} | ||
|
||
transposedNTTOutput := make(core.HostSlice[bn254_icicle.ScalarField], totalSize) | ||
|
||
for i := 0; i < numPoly; i++ { | ||
vecOps.TransposeMatrix(coeffStoreFFT[i*l*numCol:(i+1)*l*numCol], transposedNTTOutput[i*l*numCol:(i+1)*l*numCol], l, numCol, ctx, false, false) | ||
} | ||
|
||
return transposedNTTOutput, nil | ||
} |
This file contains 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,12 @@ | ||
package gpu_test | ||
|
||
import ( | ||
"testing" | ||
) | ||
|
||
// numRow and numCol describes input dimension | ||
func TestTranspose(t *testing.T) { | ||
|
||
//gpu.Transpose() | ||
|
||
} |
This file contains 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
This file contains 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
Oops, something went wrong.