Skip to content

Commit

Permalink
some fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
jmduarte committed Mar 14, 2023
1 parent 2d1e816 commit 25ff3bc
Show file tree
Hide file tree
Showing 7 changed files with 19 additions and 14 deletions.
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
*.o
*.so
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#include "NN/GTADModel.h"
#include "NN/GTADModel_v1.h"
#include "emulator.h"
#include "NN/nnet_utils/nnet_common.h"
#include <any>
Expand All @@ -16,7 +16,7 @@
//AD_NNNOUTPUTS = N_LAYER_6 = 13
//AD_NNNINPUTS = N_INPUT_1_1 = 57

class GTADModel_model : public HLS4MLModel {
class GTADModel_emulator_v1 : public hls4mlEmulator::Model {

private:
input_t _input[N_INPUT_1_1];
Expand All @@ -41,13 +41,13 @@ class GTADModel_model : public HLS4MLModel {
//then fill scaled inputs
for (int i = 0; i < N_INPUT_1_1; i++) {
// _input[i] = std::any_cast<input_t>(scaled_input[i])
_input[i] = scaled_input[i] //dont think any_cast needed here but correct me if I'm wrong
_input[i] = scaled_input[i]; //dont think any_cast needed here but correct me if I'm wrong
}

}

virtual void predict() {
GTADModel(_input, _result);
GTADModel_v1(_input, _result);
}

virtual void read_result(std::any result) {
Expand Down Expand Up @@ -87,7 +87,7 @@ class GTADModel_model : public HLS4MLModel {
};

extern "C" hls4mlEmulator::Model* create_model() {
return new GTADModel_model;
return new GTADModel_emulator_v1;
}

extern "C" void destroy_model(hls4mlEmulator::Model* m) {
Expand Down
7 changes: 5 additions & 2 deletions AXOL1TL_v1/Makefile
Original file line number Diff line number Diff line change
@@ -1,10 +1,13 @@
.PHONY: clean

GTADModel.so: GTADModel_emulator.o GTADModel.o
GTADModel_v1.so: GTADModel_emulator_v1.o GTADModel_v1.o
$(CXX) $(CXXFLAGS) $(LD_FLAGS) -shared $^ -o $@

%.o: NN/%.cpp
$(CXX) $(CXXFLAGS) $(INCLUDES) -c $< -o $@

%.o: %.cpp
$(CXX) $(CXXFLAGS) $(INCLUDES) -c $< -o $@

clean:
rm GTADModel.so
rm GTADModel_v1.so
Original file line number Diff line number Diff line change
Expand Up @@ -18,10 +18,10 @@
//
#include <iostream>

#include "GTADModel.h"
#include "GTADModel_v1.h"
#include "parameters.h"

void GTADModel(
void GTADModel_v1(
input_t _input[N_INPUT_1_1],
result_t _result[N_LAYER_6]
) {
Expand Down
2 changes: 1 addition & 1 deletion AXOL1TL_v1/NN/GTADModel.h → AXOL1TL_v1/NN/GTADModel_v1.h
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@
#include "defines.h"

// Prototype of top level function for C-synthesis
void GTADModel(
void GTADModel_v1(
input_t _input[N_INPUT_1_1],
result_t _result[N_LAYER_6]
);
Expand Down
2 changes: 1 addition & 1 deletion AXOL1TL_v1/scales.h
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
#ifndef __ADT_SCALES_H
#define __ADT_SCALES_H

#include "NN/GTADModel.h"
#include "NN/GTADModel_v1.h"

//N_INPUT_1_1=AD_NNNINPUTS
static const int32_t ad_shift[N_INPUT_1_1] = {
Expand Down
6 changes: 3 additions & 3 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ HLS_ROOT := ../../hls
HLS4ML_INCLUDE := $(EMULATOR_EXTRAS)/include/hls4ml
INCLUDES := -I$(HLS4ML_INCLUDE) -I$(AP_TYPES) -I$(HLS_ROOT)/include
LD_FLAGS := -L$(EMULATOR_EXTRAS)/lib64 -lemulator_interface
ALL_VERSIONS:=AXOL1TL_v1/GTADModel.so
ALL_VERSIONS:=AXOL1TL_v1/GTADModel_v1.so

.DEFAULT_GOAL := all
.PHONY: all clean install
Expand All @@ -19,10 +19,10 @@ all: $(ALL_VERSIONS)
install: all
@rm -rf $(PREFIX)/lib64
@mkdir -p $(PREFIX)/lib64
cp GTADModel*.so $(PREFIX)/lib64
cp GTADModel_v1*.so $(PREFIX)/lib64

%.so:
$(MAKE) -C $(@D) INCLUDES="$(INCLUDES)" LD_FLAGS="$(LD_FLAGS)" CXXFLAGS="$(CXXFLAGS)"

clean:
rm GTADModel*.so
rm GTADModel_v1*.so

0 comments on commit 25ff3bc

Please sign in to comment.