Skip to content

Instantly share code, notes, and snippets.

View marty1885's full-sized avatar
👨‍💻
Writing code

Martin Chang marty1885

👨‍💻
Writing code
View GitHub Profile
#include <functional>
#include <iostream>
using namespace std;
template<typename TFunc, typename FFunc>void If(bool condition, TFunc tFunc,
FFunc fFunc)
{
std::function<void()> jumpTable[2] = {fFunc,tFunc};
jumpTable[static_cast<int>(condition)]();
/*
Copyright (c) 2013, Taiga Nomi and the respective contributors
All rights reserved.
Use of this source code is governed by a BSD-style license that can be found
in the LICENSE file.
*/
#include <iostream>
#include "tiny_dnn/tiny_dnn.h"
__kernel foo(float* in, float* out)
{
int id = get_global_id(0);
out[id] = in[id]*100;
}
__kernel bar(float* out)
{
int id = get_global_id(0);
out[id] = 0;
#include <iostream>
#include <vector>
#include <string>
#include <random>
#include <assert.h>
#define STB_IMAGE_IMPLEMENTATION
#include "3rdparty/stb_image.h"
#define STB_IMAGE_WRITE_IMPLEMENTATION
$ cmake --build . --config Release --target check
[ 4%] Built target addkernels
[ 4%] Built target addkernels_run
Scanning dependencies of target MIOpen
[ 6%] Building CXX object src/CMakeFiles/MIOpen.dir/__/kernel.cpp.o
[ 7%] Linking CXX shared library ../lib/libMIOpen.so
[ 68%] Built target MIOpen
[ 69%] Linking CXX executable ../bin/test_main
[ 71%] Built target test_main
[ 73%] Linking CXX executable ../bin/test_pooling_test
[ 4%] Built target addkernels
[ 4%] Built target addkernels_run
Scanning dependencies of target MIOpen
[ 6%] Building CXX object src/CMakeFiles/MIOpen.dir/__/kernel.cpp.o
[ 7%] Building CXX object src/CMakeFiles/MIOpen.dir/ocl/handleocl.cpp.o
[ 9%] Linking CXX shared library ../lib/libMIOpen.so
[ 68%] Built target MIOpen
[ 69%] Linking CXX executable ../bin/test_main
[ 71%] Built target test_main
[ 73%] Linking CXX executable ../bin/test_pooling_test
bin/test_conv: /opt/cuda/lib64/libOpenCL.so.1: no version information available (required by bin/test_conv)
bin/test_conv: /opt/cuda/lib64/libOpenCL.so.1: no version information available (required by /home/marty/文件/MIOpen/lib/libMIOpen.so.1)
bin/test_main: /opt/cuda/lib64/libOpenCL.so.1: no version information available (required by bin/test_main)
bin/test_main: /opt/cuda/lib64/libOpenCL.so.1: no version information available (required by /home/marty/文件/MIOpen/lib/libMIOpen.so.1)
miopenStatus_t miopenCreateTensorDescriptor(miopenTensorDescriptor**){
tensorDesc = 0x770000005d
}
miopenStatus_t miopenSet4dTensorDescriptor(miopenTensorDescriptor_t, miopenDataType_t, int, int, int, int){
tensorDesc =
dataType = 1
uint wei_stg_off = wei_stg_base_off +
o_c * MLO_N_IN_TILES_PERSTACK * MLO_FILTER_SZ +
k_act * MLO_FILTER_SIZE0;
if(wei_stg_off + MLO_FILTER_SIZE0 > MLO_WEIGHTS_SZ)
printf("%d\n",wei_stg_off);
for(uint i = 0; i < MLO_FILTER_SIZE0; ++i)
{
//Comment offset out so it don't crash on NV/Intel OpenCL
//This might not be needed for a AMD system
pvt_wei_stage[i] = lcl_wei[/*wei_stg_off + */i];
diff --git a/src/kernels/MIOpenConvDirUniC.cl b/src/kernels/MIOpenConvDirUniC.cl
index 6a92a63..9a72f2d 100644
--- a/src/kernels/MIOpenConvDirUniC.cl
+++ b/src/kernels/MIOpenConvDirUniC.cl
@@ -325,9 +325,13 @@ static inline void Conv(uint o_map_base,
uint wei_stg_off = wei_stg_base_off +
o_c * MLO_N_IN_TILES_PERSTACK * MLO_FILTER_SZ +
k_act * MLO_FILTER_SIZE0;
+ if(wei_stg_off + MLO_FILTER_SIZE0 > MLO_WEIGHTS_SZ)
+ printf("%d\n",wei_stg_off);
#include <xtensor/xarray.hpp>
#include <xtensor/xrandom.hpp>
#include <xtensor/xio.hpp>
#include <xtensor/xindexview.hpp>
#include <xtensor-blas/xlinalg.hpp>
#include <iostream>
#include <vector>
using namespace std;