Revision bd62a3563de0004936f6506fdc5921210cb3bf14 authored by Zalman Stern on 08 June 2023, 01:18:19 UTC, committed by GitHub on 08 June 2023, 01:18:19 UTC
* Completely rework how RISC-V vector intrinsics are called to avoid
issues iwth single element vectors being confused with scalars and
other conversions that can happen via using call_intrin.

Allows using any size vector. Only downside is splitting large vectors
no longer happens, but RISC-V allows an LMUL of 8, meaning a vector of
up to 8 times the vector register size will compile so this is much
less of an issue. Splitting larger vectors can be added.

Should also allow fractionaly LMUL in all cases, but this is not
verified.

* Significant refactor/rewrite of RISC V vector intrinsics
support. Should handle many more cases and be well on the way to
handling arbitary vector widths within the LMUL range.

More tests added to simd_op_check_riscv .

Likely well setup to move SVE2 to a similar approach, perhaps without
the full genearilty on vector lengths. (I.e. they may need to be
quantized to vscale, or offer better performance in that case.)

* Formatting fixes.

* More formatting.

* Don't try to convert void types to match expected vector type.

* Backout comment change that is no longer relevant.

* Fix failure in camera_pipe app. (Code to make sure vector types match
was being presented with a scalar only mismatch. Changed it to ignore
scalar to scalar cases.)

Address review feedback.

* One more review comment.

* Comment fix.

---------

Co-authored-by: Steven Johnson <srj@google.com>
1 parent 67eaff3
Raw File
Makefile
include ../support/Makefile.inc

CXX ?= c++

TOP := $(abspath $(dir $(lastword $(MAKEFILE_LIST)))/../..)
.PHONY: all $(TOP)
all: run run-two
HALIDE_LIB := $(TOP)/$(LIBHALIDE_LDFLAGS)
$(HALIDE_LIB): $(TOP)
	$(MAKE) -C $(TOP)

test_%: test_%.cpp
	$(CXX) -std=c++17 -I ../../include/ $< -L ../../bin/ -lHalide $(HALIDE_SYSTEM_LIBS) -o $@ -g

avg_filter_uint32t.o avg_filter_uint32t.h avg_filter_float.o avg_filter_float.h: test_oglc_avg
	LD_LIBRARY_PATH=../../bin DYLD_LIBRARY_PATH=../../bin HL_TARGET=arm-32-android-armv7s-openglcompute ./$<

avg_filter_uint32t_arm.o avg_filter_uint32t_arm.h avg_filter_float_arm.o avg_filter_float_arm.h: test_oglc_avg
	LD_LIBRARY_PATH=../../bin DYLD_LIBRARY_PATH=../../bin HL_TARGET=arm-32-android-armv7s ./$< "_arm"

AVG_FILTER_SRC = jni/oglc_run.cpp \
                 avg_filter_uint32t.o avg_filter_uint32t.h \
                 avg_filter_uint32t_arm.o avg_filter_uint32t_arm.h \
                 avg_filter_float.o avg_filter_float.h \
                 avg_filter_float_arm.o avg_filter_float_arm.h

libs/armeabi-v7a/oglc_run: $(HALIDE_LIB) $(AVG_FILTER_SRC)
	ndk-build libs/armeabi-v7a/oglc_run

two_kernels_filter.o two_kernels_filter.h: test_two_kernels
	LD_LIBRARY_PATH=../../bin DYLD_LIBRARY_PATH=../../bin HL_TARGET=arm-32-android-armv7s-openglcompute ./$<

TWO_KERNELS_SRC = jni/oglc_two_kernels_run.cpp \
                  two_kernels_filter.o two_kernels_filter.h

libs/armeabi-v7a/oglc_two_kernels_run: $(HALIDE_LIB) $(TWO_KERNELS_SRC)
	ndk-build libs/armeabi-v7a/oglc_two_kernels_run libs/armeabi-v7a/liboglc_two_kernels.so

jni-libs: $(HALIDE_LIB) $(AVG_FILTER_SRC) $(TWO_KERNELS_SRC)
	ndk-build libs/armeabi-v7a/liboglc_two_kernels.so libs/armeabi-v7a/liboglc.so

deploy: libs/armeabi-v7a/oglc_run
	adb push libs/armeabi-v7a/oglc_run /mnt/sdcard/

define RUN_STEPS
su
mkdir -p /data/tmp
rm -rf /data/tmp/oglc
mkdir /data/tmp/oglc
cd /data/tmp/oglc
pwd
cp /mnt/sdcard/oglc_run .
chmod 777 /data/tmp/oglc/oglc_run
LD_LIBRARY_PATH=. ./oglc_run
exit
exit
endef
export RUN_STEPS


run: deploy
	adb logcat -c
	sh -c 'echo "$$RUN_STEPS" | adb shell'
	adb logcat -d | grep "I oglc"
	echo "Done"

deploy-two: libs/armeabi-v7a/oglc_two_kernels_run
	adb push libs/armeabi-v7a/oglc_two_kernels_run /mnt/sdcard/


define RUN_TWO_STEPS
su
mkdir /data/tmp
cd /data/tmp
pwd
cp /mnt/sdcard/oglc_two_kernels_run .
chmod 777 /data/tmp/oglc_two_kernels_run
LD_LIBRARY_PATH=. ./oglc_two_kernels_run
exit
exit
endef
export RUN_TWO_STEPS

run-two: deploy-two
	adb logcat -c
	sh -c 'echo "$$RUN_TWO_STEPS" | adb shell'
	adb logcat -d | grep "I oglc"
	echo "Done"

clean:
	rm -f test_oglc_avg
	rm -rf test_oglc_avg.dSYM/
	rm -f avg_filter*
	rm -f test_two_kernels
	rm -rf test_two_kernels.dSYM/
	rm -rf libs/
	rm -rf obj/
	rm -rf bin/
	rm -rf gen/
back to top