Skip to content

Commit

Permalink
H/graph ui polish (#6)
Browse files Browse the repository at this point in the history
* nnir_to_openvx print (ROCm#103)

* Ubuntu 18.04 warnings fix (ROCm#104)

* Support for ONNX V1.3 (ROCm#101)

ONNX 1.3 support for ResNet50

* graph ui polished
  • Loading branch information
hansely123 authored and japarada committed May 2, 2019
1 parent 66c8c5b commit 7db60ff
Show file tree
Hide file tree
Showing 8 changed files with 170 additions and 155 deletions.
4 changes: 2 additions & 2 deletions amd_openvx/openvx/ago/ago_kernel_api.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -8062,7 +8062,7 @@ int agoKernel_AbsDiff_S16_S16S16_Sat(AgoNode * node, AgoKernelCommand cmd)
agoCodeGenOpenCL_AbsDiff_S16_S16S16_Sat(node->opencl_code);
AgoData * iImg0 = node->paramList[1];
AgoData * iImg1 = node->paramList[2];
char item[128];
char item[512];
if (iImg1->u.img.isUniform && !iImg0->u.img.isUniform) {
// avoid having to read constant uniform image for AbsDiff (users might do this for Abs operation)
node->opencl_param_discard_mask = (1 << 2);
Expand Down Expand Up @@ -8624,7 +8624,7 @@ int agoKernel_Magnitude_S16_S16S16(AgoNode * node, AgoKernelCommand cmd)
else if (cmd == ago_kernel_cmd_opencl_codegen) {
status = VX_SUCCESS;
node->opencl_type = NODE_OPENCL_TYPE_REG2REG;
char textBuffer[2048];
char textBuffer[4096];
sprintf(textBuffer, OPENCL_FORMAT(
"void %s (S16x8 * p0, S16x8 p1, S16x8 p2)\n"
"{\n"
Expand Down
3 changes: 2 additions & 1 deletion amd_openvx/openvx/ago/ago_util.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1605,7 +1605,8 @@ int agoGetDataFromDescription(AgoContext * acontext, AgoGraph * agraph, AgoData
data->u.tensor.data_type = agoName2Enum(data_type);
if (data->u.tensor.data_type != VX_TYPE_INT16 &&
data->u.tensor.data_type != VX_TYPE_UINT8 && data->u.tensor.data_type != VX_TYPE_UINT16 &&
data->u.tensor.data_type != VX_TYPE_FLOAT32 && data->u.tensor.data_type != VX_TYPE_FLOAT16)
data->u.tensor.data_type != VX_TYPE_FLOAT32 && data->u.tensor.data_type != VX_TYPE_FLOAT16
&& data->u.tensor.data_type != VX_TYPE_INT64)
{
agoAddLogEntry(&data->ref, VX_FAILURE, "ERROR: agoGetDataFromDescription: invalid data_type for tensor: %s\n", data_type);
return -1;
Expand Down
4 changes: 2 additions & 2 deletions amd_openvx/openvx/ago/ago_util_opencl.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1590,7 +1590,7 @@ int agoGpuOclSuperNodeFinalize(AgoGraph * graph, AgoSuperNode * supernode)
AgoData * data = supernode->dataList[index];
}
// generate code: node functions in OpenCL
char item[256];
char item[512];
std::string code = OPENCL_FORMAT(
"#pragma OPENCL EXTENSION cl_amd_media_ops : enable\n"
"#pragma OPENCL EXTENSION cl_amd_media_ops2 : enable\n"
Expand Down Expand Up @@ -1749,7 +1749,7 @@ int agoGpuOclSuperNodeFinalize(AgoGraph * graph, AgoSuperNode * supernode)
else if (node->akernel->opencl_codegen_callback_f) {
// generation function declaration
std::string code2;
char item[256];
char item[512];
sprintf(item, "void %s(", node->opencl_name); code2 = item;
for (vx_uint32 i = 0; i < node->paramCount; i++) {
AgoData * data = node->paramList[i];
Expand Down
51 changes: 24 additions & 27 deletions apps/cloud_inference/client_app/perf_chart.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@ perf_chart::perf_chart(QWidget *parent) :
ui->setupUi(this);
mFPSValue = 0;
mMaxFPS = 0;
mScaleValueX = 5;
initGraph();
}

Expand All @@ -20,23 +19,22 @@ perf_chart::~perf_chart()
void perf_chart::initGraph()
{
ui->CustomPlot->addGraph();

QSharedPointer<QCPAxisTickerTime> timeTicker(new QCPAxisTickerTime);
timeTicker->setTimeFormat("%h:%m:%s");

// set default time duration to rb1 value
ui->rb1->setChecked(1);
// set default time duration to rb2 value
ui->rb2->setChecked(1);

// x axis
ui->CustomPlot->xAxis->setTicker(timeTicker);
ui->CustomPlot->xAxis->setTickLabelFont(QFont(QFont().family(), 8));
ui->CustomPlot->xAxis->setTickLabelFont(QFont(QFont().family(), 12));
ui->CustomPlot->xAxis->setLabel("Time Elapsed");

// y axis
ui->CustomPlot->yAxis->setTickLabelFont(QFont(QFont().family(), 12));
ui->CustomPlot->yAxis->setLabel("FPS");

ui->CustomPlot->setInteractions(QCP::iRangeDrag | QCP::iRangeZoom | QCP::iSelectPlottables);
// ui->CustomPlot->axisRect()->setupFullAxesBox();
ui->CustomPlot->axisRect()->insetLayout()->setInsetAlignment(0, Qt::AlignLeft|Qt::AlignTop);

// make left and bottom axes transfer their ranges to right and top axes:
Expand All @@ -58,29 +56,15 @@ void perf_chart::RealtimeDataSlot()
{
ui->CustomPlot->graph(0)->addData(key, mFPSValue);
lastPointKey = key;
if (ui->coloredGraph->isChecked())
{
QCPDataRange range;
range.setBegin(5);
range.setEnd(10);
QCPDataSelection selection;
selection.addDataRange(range);
ui->CustomPlot->graph(0)->setPen(QPen(Qt::blue));
ui->CustomPlot->graph(0)->setSelection(selection);
ui->CustomPlot->graph(0)->selectionDecorator()->setPen(QPen(Qt::red));


} else
{
ui->CustomPlot->graph(0)->setPen(QPen(Qt::green));
}

if (lastNumPods != mNumPods) {
QCPItemText *text = new QCPItemText(ui->CustomPlot);
text->position->setCoords(key - mScaleValueX, mFPSValue + 5);
text->setText("Pod(s) = " % QString::number(mNumPods));
text->setFont(QFont(font().family(), 10));
text->setPen(QPen(Qt::black));
lastNumPods = mNumPods;
text->position->setCoords(key - mRangeX * 0.1, mFPSValue + mRangeY * 0.1);
mPodsVector.push_back(text);
}
}
rescaleAxis(key);
Expand All @@ -103,15 +87,28 @@ void perf_chart::rescaleAxis(double key) {
ui->CustomPlot->graph(0)->rescaleValueAxis();
if (ui->rb1->isChecked()) {
ui->CustomPlot->xAxis->setRange(key+20, 30, Qt::AlignRight);
mScaleValueX = 4;
mRangeX = 30;
} else if (ui->rb2->isChecked()) {
ui->CustomPlot->xAxis->setRange(key+30, 60, Qt::AlignRight);
mScaleValueX = 6;
mRangeX = 60;
} else if (ui->rb3->isChecked()) {
ui->CustomPlot->xAxis->setRange(key+30, 120, Qt::AlignRight);
mScaleValueX = 9;
mRangeX = 120;
} else if (ui->rb4->isChecked()) {
ui->CustomPlot->xAxis->setRange(key+30, 240, Qt::AlignRight);
mRangeX = 240;
} else if (ui->rb5->isChecked()) {
ui->CustomPlot->xAxis->setRange(key+30, 480, Qt::AlignRight);
mRangeX = 480;
}
ui->CustomPlot->yAxis->setRange(0, mMaxFPS+500);
mRangeY = mMaxFPS*1.5;
ui->CustomPlot->yAxis->setRange(0, mRangeY);
mPodsVector[0]->position->setCoords(100, 100);
// for (unsigned long i=0; i<mPodsVector.size(); i++) {
// double x = mPodsVector[i]->position->key();
// double y = mPodsVector[i]->position->value();
// mPodsVector[i]->position->setCoords(x - mRangeX * 0.1, y + mRangeY * 0.1);
// }
ui->CustomPlot->replot();
}

Expand Down
6 changes: 5 additions & 1 deletion apps/cloud_inference/client_app/perf_chart.h
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@
#include <QMainWindow>
#include <QTimer>
#include <QtWidgets>
#include <vector>
#include <qcustomplot.h>

namespace Ui {
class perf_chart;
Expand All @@ -23,8 +25,10 @@ class perf_chart : public QMainWindow
int mMaxFPS = 0;
int mFPSValue;
int mNumPods;
double mScaleValueX;
double mRangeX;
double mRangeY;
void initGraph();
std::vector<QCPItemText *> mPodsVector;

public slots:
void RealtimeDataSlot();
Expand Down
Loading

0 comments on commit 7db60ff

Please sign in to comment.