Fully-functioning spawn and join instructions.
This commit is contained in:
@@ -5,12 +5,14 @@ HARPDIS = ../harptool -D
|
||||
4BARCH = 4b16/16/2
|
||||
|
||||
all: simple.bin sieve.bin 2thread.bin simple.4b.bin sieve.4b.bin 2thread.4b.bin bubble.bin bubble.4b.bin dotprod.bin dotprod.4b.bin matmul.bin matmul.4b.bin \
|
||||
matmul-mt.s
|
||||
matmul-mt.bin diverge.bin
|
||||
|
||||
run: simple.out sieve.out 2thread.out simple.4b.out sieve.4b.out 2thread.4b.out bubble.out bubble.4b.out dotprod.out dotprod.4b.out matmul.out matmul.4b.out\
|
||||
matmul-mt.out
|
||||
matmul-mt.out diverge.out
|
||||
|
||||
disas: simple.d sieve.d 2thread.d simple.4b.d sieve.4b.d 2thread.4b.d bubble.d bubble.4b.d dotprod.d dotprod.4b.d matmul.d matmul.4b.d matmul-mt.d
|
||||
disas: simple.d sieve.d 2thread.d simple.4b.d sieve.4b.d 2thread.4b.d bubble.d \
|
||||
bubble.4b.d dotprod.d dotprod.4b.d matmul.d matmul.4b.d matmul-mt.d \
|
||||
diverge.d diverge.4b.d
|
||||
|
||||
%.4b.out : %.4b.bin
|
||||
$(HARPEM) -a $(4BARCH) -c $< > $@
|
||||
@@ -18,50 +20,11 @@ disas: simple.d sieve.d 2thread.d simple.4b.d sieve.4b.d 2thread.4b.d bubble.d b
|
||||
%.out : %.bin
|
||||
$(HARPEM) -c $< > $@
|
||||
|
||||
2thread.bin : boot.HOF lib.HOF 2thread.HOF
|
||||
$(HARPLD) -o 2thread.bin $^
|
||||
|
||||
2thread.4b.bin : boot.4b.HOF lib.4b.HOF 2thread.4b.HOF
|
||||
$(HARPLD) --arch $(4BARCH) -o 2thread.4b.bin $^
|
||||
|
||||
bubble.bin : boot.HOF lib.HOF bubble.HOF
|
||||
$(HARPLD) -o bubble.bin $^
|
||||
|
||||
bubble.4b.bin : boot.4b.HOF lib.4b.HOF bubble.4b.HOF
|
||||
$(HARPLD) --arch $(4BARCH) -o bubble.4b.bin $^
|
||||
|
||||
simple.bin : boot.HOF lib.HOF simple.HOF
|
||||
$(HARPLD) -o $@ $^
|
||||
|
||||
sieve.bin : boot.HOF lib.HOF sieve.HOF
|
||||
$(HARPLD) -o $@ $^
|
||||
|
||||
dotprod.bin : boot.HOF lib.HOF dotprod.HOF
|
||||
$(HARPLD) -o $@ $^
|
||||
|
||||
matmul.bin : boot.HOF lib.HOF matmul.HOF
|
||||
$(HARPLD) -o $@ $^
|
||||
|
||||
matmul-mt.bin : boot.HOF lib.HOF matmul-mt.HOF
|
||||
$(HARPLD) -o $@ $^
|
||||
|
||||
simple.4b.bin : boot.4b.HOF lib.4b.HOF simple.4b.HOF
|
||||
%.4b.bin : boot.4b.HOF lib.4b.HOF %.4b.HOF
|
||||
$(HARPLD) --arch $(4BARCH) -o $@ $^
|
||||
|
||||
sieve.4b.bin : boot.4b.HOF lib.4b.HOF sieve.4b.HOF
|
||||
$(HARPLD) --arch $(4BARCH) -o $@ $^
|
||||
|
||||
dotprod.4b.bin : boot.4b.HOF lib.4b.HOF dotprod.4b.HOF
|
||||
$(HARPLD) --arch $(4BARCH) -o $@ $^
|
||||
|
||||
matmul.4b.bin : boot.4b.HOF lib.4b.HOF matmul.4b.HOF
|
||||
$(HARPLD) --arch $(4BARCH) -o $@ $^
|
||||
|
||||
%.4b.bin : %.4b.HOF
|
||||
$(HARPLD) --arch $(4BARCH) -o $@ $<
|
||||
|
||||
%.bin : %.HOF
|
||||
$(HARPLD) -o $@ $<
|
||||
%.bin : boot.HOF lib.HOF %.HOF
|
||||
$(HARPLD) -o $@ $^
|
||||
|
||||
%.4b.HOF : %.s
|
||||
$(HARPAS) --arch $(4BARCH) -o $@ $<
|
||||
|
||||
64
src/test/diverge.s
Normal file
64
src/test/diverge.s
Normal file
@@ -0,0 +1,64 @@
|
||||
/*******************************************************************************
|
||||
Harptools by Chad D. Kersey, Summer 2011
|
||||
********************************************************************************
|
||||
|
||||
Sample HARP assmebly program.
|
||||
|
||||
*******************************************************************************/
|
||||
/* Divergent branch: test immediate postdominator branch divergence support. */
|
||||
.def THREADS 8
|
||||
|
||||
.align 4096
|
||||
.perm x
|
||||
.entry
|
||||
.global
|
||||
entry:
|
||||
ldi %r0, #1
|
||||
ldi %r1, THREADS
|
||||
sloop: clone %r0
|
||||
|
||||
addi %r0, %r0, #1
|
||||
sub %r2, %r1, %r0
|
||||
rtop @p0, %r2
|
||||
@p0 ? jmpi sloop
|
||||
|
||||
ldi %r0, #0
|
||||
jalis %r5, %r1, dthread;
|
||||
|
||||
ldi %r0, #0
|
||||
ldi %r1, (__WORD * THREADS)
|
||||
|
||||
ploop: ld %r7, %r0, array
|
||||
jali %r5, printdec
|
||||
|
||||
addi %r0, %r0, __WORD
|
||||
sub %r7, %r1, %r0
|
||||
rtop @p0, %r7
|
||||
@p0 ? jmpi ploop
|
||||
|
||||
trap;
|
||||
|
||||
|
||||
dthread: ldi %r1, #10
|
||||
ldi %r2, #0
|
||||
|
||||
loop: andi %r3, %r0, #1
|
||||
rtop @p1, %r3
|
||||
@p1 ? split
|
||||
@p1 ? jmpi else
|
||||
add %r2, %r2, %r0
|
||||
jmpi after
|
||||
else: sub %r2, %r2, %r0
|
||||
after: join
|
||||
|
||||
subi %r1, %r1, #1
|
||||
rtop @p0, %r1
|
||||
@p0 ? jmpi loop
|
||||
|
||||
shli %r4, %r0, (`__WORD)
|
||||
st %r2, %r4, array
|
||||
|
||||
jmprt %r5;
|
||||
|
||||
.align 4096
|
||||
array: .space 4096
|
||||
Reference in New Issue
Block a user