dumping ANE docs
MODIFY
ane/2_compile/.gitignore
ane/2_compile/.gitignore
*.hwx
+anecompiler.swap.*

RENAME
ane/2_compile/compile.m
ane/2_compile/compile.mm
#include <os/log.h>
#include <stdio.h>
#import <CoreFoundation/CoreFoundation.h>
+#include <string>
+extern "C" {
int ANECCompile(CFDictionaryRef param_1, CFDictionaryRef param_2, unsigned long param_3);
+ std::string _ZN21ZinIrEnumToStringUtil14OpCodeToStringE22ZinIrOpLayerOpCodeType(int op);
+ std::string _ZN21ZinIrEnumToStringUtil21NonLinearModeToStringE18ZinIrNonLinearMode(int op);
+}
int main(int argc, char* argv[]) {
os_log(OS_LOG_DEFAULT, "start compiler");
+ /*for (int i = 0; i < 60; i++) {
+ std::string tmp = _ZN21ZinIrEnumToStringUtil14OpCodeToStringE22ZinIrOpLayerOpCodeType(i);
+ //std::string tmp = _ZN21ZinIrEnumToStringUtil21NonLinearModeToStringE18ZinIrNonLinearMode(i);
+ printf("%2d: %s\n", i, tmp.c_str());
+ }*/
+
CFTypeRef ikeys[2];
ikeys[0] = CFSTR("NetworkPlistName");
ikeys[1] = CFSTR("NetworkPlistPath");
@@ -30,7 +41,8 @@ int main(int argc, char* argv[]) {
if (argc > 2) {
CFDictionaryAddValue(optionsDictionary, CFSTR("OutputFileName"), CFSTR("debug/model.hwx"));
- CFDictionaryAddValue(flagsDictionary, CFSTR("DebugDetailPrint"), kCFBooleanTrue);
+ //CFDictionaryAddValue(flagsDictionary, CFSTR("DebugDetailPrint"), kCFBooleanTrue);
+ CFDictionaryAddValue(flagsDictionary, CFSTR("CompileANEProgramForDebugging"), kCFBooleanTrue);
int debug_mask = 0x7fffffff;
CFDictionaryAddValue(flagsDictionary, CFSTR("DebugMask"), CFNumberCreate(kCFAllocatorDefault, 3, &debug_mask));
} else {
@@ -46,5 +58,6 @@ int main(int argc, char* argv[]) {
int ret = ANECCompile(optionsDictionary, flagsDictionary, 0);
printf("compile: %d\n", ret);
+
return ret;
}

MODIFY
ane/2_compile/compile.sh
ane/2_compile/compile.sh
#!/bin/bash
-gcc compile.m -F /System/Library/PrivateFrameworks/ -framework ANECompiler -framework CoreFoundation
+g++ compile.mm -F /System/Library/PrivateFrameworks/ -framework ANECompiler -framework CoreFoundation
rm -f model.hwx
-./a.out net.plist
+./a.out net.plist debug
+rm -f context_switch_log.txt
log show --process a.out --last 1m --info --debug

MODIFY
ane/README
ane/README
@@ -44,6 +44,27 @@ TODO: Write a nice plist grabber
DONE: Write a call to the compiler with plist+weights
DONE: Write an hwx runner
+== Tracing the Compiler ==
+
+ANECCompileProcedure
+ ZinAneCreateIr
+ ZinParseNeuronUnit
+ ZinAneCoreCompile
+ ZinAneCodeGeneration
+ ZinIrCodegenHandleKernels
+ ZinIrTargetH13::CodegenTds
+ ZinIrCacheHintTable
+ ZinIrCodegenHandleTds_v7
+ ZinIrCodegenHandleTdsMakeList<7u>
+ ZinAneInstruction
+ ZinAneTd<7u>::HandleEngineLayer
+ ZinAneInstruction::HandleTdHeader
+ HandleNELayer<7u>
+ ZinAneInstruction::HandleCommonConfig
+ ZinAneInstruction::HandleCommonConfigCommonOpcodes
+
+rbreak ^ZinAneInstruction*
+
== Zin Constants ==
kZinIrOpCodeConv = 0?
@@ -54,6 +75,56 @@ kZinIrOpCodeFlattenComposite
kZinIrOpCodeNEConvOp
kZinIrOpCodeTranspose
+ 0: CONV
+ 1: POOL
+ 2: SCALE_BIAS
+ 3: TERNARY_DYNAMIC_GOC
+ 4: BINARY_DYNAMIC_GOC
+ 5: ACTIVATION
+ 6: EW
+ 7: SCALED_EW
+ 8: CONCAT
+ 9: SPLIT
+10: COPY
+11: FLATTEN
+12: UNFLATTEN
+13: CROSS_CORRELATION
+14: KERNEL_RASTERIZER
+15: ARG_MIN_MAX
+16: MATRIX_MULT
+17: BROADCAST
+18: FLATTEN_COMPOSITE
+19: UNFLATTEN_COMPOSITE
+20: KERNEL_RASTERIZER_COMPOSITE
+21: CROSS_CORRELATION_COMPOSITE
+22: LIVE_IN
+23: CONST_IN
+24: LIVE_OUT
+25: REDUCTION
+26: ALIAS
+27: Typecast
+28: RESHAPE
+29: VIEW
+30: TRANSPOSE
+31: SPACE_TO_BATCH
+32: BATCH_TO_SPACE
+33: SOFTMAX
+34: INSTANCE_NORM
+35: L2_NORM
+36: MINMAX_NORM
+37: LRN
+38: COST_VOLUME
+39: PIXEL_SHUFFLE
+40: FPS
+41: RS
+42: PEFUSED_ELEMENTWISE
+43: PEFUSED_POOL
+44: PEFUSED_GOC
+45: NEFUSED_CONV
+46: NEFUSED_POOL
+47: NEFUSED_EW
+48: NEFUSED_BYPASS
+
# guessing from the hwx
kZinTensorFormatUInt8 = 0
kZinTensorFormatInt8 = 1
@@ -63,7 +134,8 @@ kZinTensorFormatInvalid
Zin (plist format) ---(ZinAneCoreCompile)---> Mir (hwx format)?
ZinAneCodeGeneration?
-== Neuron Types ==
+ZinIrStatus GetKernelFormat<6u>(ZinKernelFormat param_1,ane_ne_kernel_cfg_kernel_fmt *param_2)
+ List of allowed numbers
NeuronTypes (changes the LUT):
Tanh
@@ -75,6 +147,39 @@ NeuronTypes (changes the LUT):
Investigate:
ZinMirActivationV7::PrintLut(ZinMirActivationV7 *this,ane_nonlinear_lut_v7up_t *param_1
+ 0: NONE
+ 1: RELU
+ 2: SIGMOID
+ 3: SIGMOID_HIGH_PRECISION
+ 4: TANH
+ 5: CLAMPED_RELU
+ 6: PRELU
+ 7: DIRAC
+ 8: INT
+ 9: FRAC
+10: SQRT
+11: RSQRT
+12: INV
+13: SQR
+14: LOG2
+15: EXP2
+16: ELU
+17: SIGN
+18: EQUAL_ZERO
+19: NON_ZERO
+20: LESS_THAN_ZERO
+21: LESS_EQUAL_ZERO
+22: GREATER_EQUAL_ZERO
+23: GREATER_THAN_ZERO
+24: CUSTOM_LUT
+25: C_DIM_CONCAT
+26: C_DIM_STRIDED_CONCAT
+27: H_DIM_CONCAT
+28: W_DIM_CONCAT
+29: D_DIM_CONCAT
+30: N_DIM_CONCAT
+31: H_DIM_STRIDED_CONCAT
+
== min.plist ==
Types: GOC, Conv, Broadcast, ScaledElementWise, Reshape, InputView, Neuron, Concat

dumping ANE docs