Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
H
hpvm-release
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Model registry
Operate
Environments
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
llvm
hpvm-release
Commits
2dee642f
Commit
2dee642f
authored
8 years ago
by
Prakalp Srivastava
Browse files
Options
Downloads
Patches
Plain Diff
local changes to sgemm visc_sh. Removed some comments etc.
parent
8870af63
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
llvm/test/VISC/parboil/benchmarks/sgemm/src/visc_sh/main.cc
+11
-24
11 additions, 24 deletions
llvm/test/VISC/parboil/benchmarks/sgemm/src/visc_sh/main.cc
with
11 additions
and
24 deletions
llvm/test/VISC/parboil/benchmarks/sgemm/src/visc_sh/main.cc
+
11
−
24
View file @
2dee642f
...
...
@@ -91,25 +91,17 @@ void packData(RootIn* args,
args
->
grid_y
=
grid_y
;
}
// TODO: decide between dynamic vs static allocation. Merely a convension - will
// be translated.
void
Allocation
(
int
block_x
,
int
block_y
)
{
// Memory shared between threadblocks
//int bl_x = TILE_N;
//int bl_y = TILE_TB_HEIGHT;
//void* shB = __visc__malloc(bl_x*bl_y*sizeof(float));
void
*
shB
=
__visc__malloc
(
block_x
*
block_y
*
sizeof
(
float
));
//__visc__return(shB, bl_x*bl_y*sizeof(float));
__visc__return
(
shB
,
block_x
*
block_y
*
sizeof
(
float
));
}
void
SgemmLeaf
(
float
*
A
,
size_t
bytesA
,
int
lda
,
float
*
B
,
size_t
bytesB
,
int
ldb
,
float
*
C
,
size_t
bytesC
,
int
ldc
,
int
k
,
float
alpha
,
float
beta
,
float
*
shB
,
size_t
bytesshB
)
{
void
SgemmLeaf
(
float
*
A
,
size_t
bytesA
,
int
lda
,
float
*
B
,
size_t
bytesB
,
int
ldb
,
float
*
C
,
size_t
bytesC
,
int
ldc
,
int
k
,
float
alpha
,
float
beta
,
float
*
shB
,
size_t
bytesshB
)
{
__visc__hint
(
visc
::
DEVICE
);
//__visc__hint(visc::SPIR_TARGET);
// TODO: shB is not an in or out attribute
//__visc__hint(visc::GPU_TARGET);
__visc__attributes
(
3
,
A
,
B
,
C
,
1
,
C
);
void
*
thisNode
=
__visc__getNode
();
...
...
@@ -153,7 +145,7 @@ void SgemmLeaf( float* A, size_t bytesA, int lda, float* B, size_t bytesB, int l
}
}
//
Thread block
node for sgemm - Creates allocation node and leaf (
thread
) node
//
Work group
node for sgemm - Creates allocation node and leaf (
work item
) node
void
SgemmTB
(
float
*
A
,
size_t
bytesA
,
int
lda
,
float
*
B
,
size_t
bytesB
,
...
...
@@ -192,10 +184,9 @@ void SgemmTB(float *A, size_t bytesA,
__visc__edge
(
AllocationNode
,
SgemmLeafNode
,
1
,
0
,
12
,
0
);
// Edge local_B
__visc__edge
(
AllocationNode
,
SgemmLeafNode
,
1
,
1
,
13
,
0
);
// Edge bytes_local_B
//TODO: bindOut : for now with out attribute
}
// Root node for sgemm - Creates
thread block
node
// Root node for sgemm - Creates
work group
node
void
SgemmRoot
(
float
*
A
,
size_t
bytesA
,
int
lda
,
float
*
B
,
size_t
bytesB
,
...
...
@@ -229,7 +220,6 @@ void SgemmRoot(float *A, size_t bytesA,
__visc__bindIn
(
SgemmTBNode
,
12
,
12
,
0
);
// Bind block_x
__visc__bindIn
(
SgemmTBNode
,
13
,
13
,
0
);
// Bind block_y
//TODO: bindOut : for now with out attribute
}
// Creates root node for sgemm
...
...
@@ -254,14 +244,12 @@ __attribute__((noinline)) void basicSgemm(struct pb_TimerSet* timers, char trans
// unsigned db[2] = {TILE_N,TILE_TB_HEIGHT};
// unsigned dg[2] = {m*TILE_N/TILE_M,n*TILE_TB_HEIGHT/TILE_N};
// unsigned dg[2] = {m*db[0]/TILE_M,n*db[1]/TILE_N};
// unsigned sgemmDFG = __visc__node(mysgemmNT, 2, 2, db[0], db[1], dg[0]/db[0], dg[1]/db[1], 12, A, bytesA, lda, B, bytesB, ldb, C, bytesC, ldc, k, alpha, beta, 0);
int
block_x
=
TILE_N
;
int
block_y
=
TILE_TB_HEIGHT
;
int
grid_x
=
m
/
TILE_M
;
int
grid_y
=
n
/
TILE_N
;
// Pack data in struct
RootIn
*
args
=
(
RootIn
*
)
malloc
(
sizeof
(
RootIn
));
packData
(
args
,
...
...
@@ -344,7 +332,8 @@ int main (int argc, char *argv[]) {
// Use standard sgemm interface
basicSgemm
(
&
timers
,
'N'
,
'T'
,
matArow
,
matBcol
,
matAcol
,
1.0
f
,
\
&
matA
.
front
(),
A_sz
,
matArow
,
&
matBT
.
front
(),
B_sz
,
matBcol
,
0.0
f
,
&
matC
.
front
(),
C_sz
,
matArow
);
&
matA
.
front
(),
A_sz
,
matArow
,
&
matBT
.
front
(),
B_sz
,
matBcol
,
0.0
f
,
&
matC
.
front
(),
C_sz
,
matArow
);
pb_SwitchToTimer
(
&
timers
,
pb_TimerID_COPY
);
llvm_visc_request_mem
(
&
matC
.
front
(),
C_sz
);
...
...
@@ -360,11 +349,9 @@ int main (int argc, char *argv[]) {
__visc__cleanup
();
if
(
params
->
outFile
)
{
/* Write C to file */
//pb_SwitchToTimer(&timers, pb_TimerID_IO);
writeColMajorMatrixFile
(
params
->
outFile
,
matArow
,
matBcol
,
matC
);
/* Write C to file */
//pb_SwitchToTimer(&timers, pb_TimerID_IO);
writeColMajorMatrixFile
(
params
->
outFile
,
matArow
,
matBcol
,
matC
);
}
double
GPUtime
=
pb_GetElapsedTime
(
&
(
timers
.
timers
[
pb_TimerID_KERNEL
]));
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment