"src/vscode:/vscode.git/clone" did not exist on "5f31ae3ffc0f15a7030ee5211c0fe2fabacbcc48"
Commit 4a39a0f7 authored by Shucai Xiao's avatar Shucai Xiao
Browse files

Merge branch 'develop' of github.com:ROCmSoftwarePlatform/AMDMIGraphX into add-conv_bn_add-test

parents 5564172e bb827865
opencv-python
onnxruntime
\ No newline at end of file
......@@ -339,8 +339,7 @@
"mimetype": "text/x-python",
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
"version": "3.6.9"
"pygments_lexer": "ipython3"
}
},
"nbformat": 4,
......
......@@ -210,8 +210,7 @@
"mimetype": "text/x-python",
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
"version": "3.6.9"
"pygments_lexer": "ipython3"
}
},
"nbformat": 4,
......
# U-Net Image Segmentation Inference with AMD MIGraphX
This examples provides a simple example for utilizing U-Net ONNX model for image segmentation, using AMD MIGraphX graph optimization engine for fast inference.
## How-to
Please utilize the notebook given `unet_inference.ipynb`.
## Model Details
ONNX model utilized in this example can be found [here](https://www.dropbox.com/s/3ntkhyk30x05uuv/unet_13_256.onnx).
\ No newline at end of file
numpy
matplotlib
\ No newline at end of file
{
"cells": [
{
"cell_type": "markdown",
"id": "cd7a3990",
"metadata": {},
"source": [
"## Import MIGraphX Python Library"
]
},
{
"cell_type": "code",
"execution_count": null,
"id": "3930d7b8",
"metadata": {},
"outputs": [],
"source": [
"import migraphx\n",
"from PIL import Image\n",
"import numpy as np\n",
"import matplotlib.pyplot as plt"
]
},
{
"cell_type": "markdown",
"id": "b350c333",
"metadata": {},
"source": [
"## Fetch U-NET ONNX Model"
]
},
{
"cell_type": "code",
"execution_count": null,
"id": "02a7b7de",
"metadata": {},
"outputs": [],
"source": [
"!wget -nc https://www.dropbox.com/s/3ntkhyk30x05uuv/unet_13_256.onnx"
]
},
{
"cell_type": "markdown",
"id": "a6cfe6e9",
"metadata": {},
"source": [
"## Load ONNX Model"
]
},
{
"cell_type": "code",
"execution_count": null,
"id": "e05a13dc",
"metadata": {},
"outputs": [],
"source": [
"model = migraphx.parse_onnx(\"unet_13_256.onnx\")"
]
},
{
"cell_type": "code",
"execution_count": null,
"id": "52c67023",
"metadata": {},
"outputs": [],
"source": [
"model.compile(migraphx.get_target(\"gpu\"))"
]
},
{
"cell_type": "markdown",
"id": "80edb6f1",
"metadata": {},
"source": [
"## Print model parameters"
]
},
{
"cell_type": "code",
"execution_count": null,
"id": "fd5c3269",
"metadata": {},
"outputs": [],
"source": [
"print(model.get_parameter_names())\n",
"print(model.get_parameter_shapes())"
]
},
{
"cell_type": "code",
"execution_count": null,
"id": "47f956c7",
"metadata": {},
"outputs": [],
"source": [
"def preprocess(pil_img, newW, newH):\n",
" w, h = pil_img.size\n",
" assert newW > 0 and newH > 0, 'Scale is too small'\n",
" pil_img = pil_img.resize((newW, newH))\n",
"\n",
" img_nd = np.array(pil_img)\n",
"\n",
" if len(img_nd.shape) == 2:\n",
" img_nd = np.expand_dims(img_nd, axis=2)\n",
"\n",
" # HWC to CHW\n",
" img_print = pil_img\n",
" img_trans = img_nd.transpose((2, 0, 1))\n",
" if img_trans.max() > 1:\n",
" img_trans = img_trans / 255\n",
" \n",
" img_trans = np.expand_dims(img_trans, 0)\n",
"\n",
" return img_trans, img_print\n",
"\n",
"def plot_img_and_mask(img, mask):\n",
" classes = mask.shape[0] if len(mask.shape) > 3 else 1\n",
" print(classes)\n",
" fig, ax = plt.subplots(1, classes + 1)\n",
" ax[0].set_title('Input image')\n",
" ax[0].imshow(img)\n",
" if classes > 1:\n",
" for i in range(classes):\n",
" ax[i+1].set_title(f'Output mask (class {i+1})')\n",
" ax[i+1].imshow(mask[:, :, i])\n",
" else:\n",
" ax[1].set_title(f'Output mask')\n",
" ax[1].imshow(mask[0,0])\n",
" plt.xticks([]), plt.yticks([])\n",
" plt.show()"
]
},
{
"cell_type": "code",
"execution_count": null,
"id": "389ddc4d",
"metadata": {},
"outputs": [],
"source": [
"img = Image.open(\"./car1.jpeg\")\n",
"img, imPrint = preprocess(img, 256, 256)\n",
"input_im = np.zeros((1,3,256,256),dtype='float32') \n",
"np.lib.stride_tricks.as_strided(input_im, shape=img.shape, strides=input_im.strides)[:] = img #getting correct stride\n",
"print(input_im.strides)\n",
"print(input_im.shape)\n",
"imPrint.show()"
]
},
{
"cell_type": "code",
"execution_count": null,
"id": "9de6f2a7",
"metadata": {},
"outputs": [],
"source": [
"mask = model.run({'inputs':input_im}) # Your first inference would take longer than the following ones.\n",
"output_mask = np.array(mask[0])\n",
"print(output_mask.shape)"
]
},
{
"cell_type": "code",
"execution_count": null,
"id": "acbd68e3",
"metadata": {},
"outputs": [],
"source": [
"def sigmoid(x):\n",
" return 1 / (1 + np.exp(-x))"
]
},
{
"cell_type": "code",
"execution_count": null,
"id": "58e3062c",
"metadata": {},
"outputs": [],
"source": [
"probs = sigmoid(output_mask)\n",
"full_mask = probs > 0.996\n",
"plot_img_and_mask(imPrint, full_mask)"
]
},
{
"cell_type": "markdown",
"id": "6126df0b",
"metadata": {},
"source": [
"<b>NOTE:</b> The model weights utilized here are trained by using car images with plain backgrounds. The imperfect result on a \"real-world\" image as shown above is expected. To get a better result fine-tuning the model on a dataset of real-world examples is recommended. "
]
}
],
"metadata": {
"kernelspec": {
"display_name": "Python 3",
"language": "python",
"name": "python3"
},
"language_info": {
"codemirror_mode": {
"name": "ipython",
"version": 3
},
"file_extension": ".py",
"mimetype": "text/x-python",
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3"
}
},
"nbformat": 4,
"nbformat_minor": 5
}
# YoloV4 Object Detection
The notebook [yolov4_inference.ipynb](./yolov4_inference.ipynb) is intended to be an example of how to use MIGraphX to perform object detection. The model used within is a pre-trained yolov4 from the ONNX model zoo.
## Run the Notebook
To run the example notebook, simply issue the following command from this directory:
```
$ jupyter notebook yolov4_inference.ipynb
```
# All pre- and post-processing methods used below are borrowed from the ONNX MOdel Zoo
# https://github.com/onnx/models/tree/master/vision/object_detection_segmentation/yolov4
import numpy as np
import cv2
from scipy import special
import colorsys
import random
# this function is from tensorflow-yolov4-tflite/core/utils.py
def image_preprocess(image, target_size, gt_boxes=None):
ih, iw = target_size
h, w, _ = image.shape
scale = min(iw / w, ih / h)
nw, nh = int(scale * w), int(scale * h)
image_resized = cv2.resize(image, (nw, nh))
image_padded = np.full(shape=[ih, iw, 3], fill_value=128.0)
dw, dh = (iw - nw) // 2, (ih - nh) // 2
image_padded[dh:nh + dh, dw:nw + dw, :] = image_resized
image_padded = image_padded / 255.
if gt_boxes is None:
return image_padded
else:
gt_boxes[:, [0, 2]] = gt_boxes[:, [0, 2]] * scale + dw
gt_boxes[:, [1, 3]] = gt_boxes[:, [1, 3]] * scale + dh
return image_padded, gt_boxes
def get_anchors(anchors_path, tiny=False):
'''loads the anchors from a file'''
with open(anchors_path) as f:
anchors = f.readline()
anchors = np.array(anchors.split(','), dtype=np.float32)
return anchors.reshape(3, 3, 2)
def postprocess_bbbox(pred_bbox, ANCHORS, STRIDES, XYSCALE=[1, 1, 1]):
'''define anchor boxes'''
for i, pred in enumerate(pred_bbox):
conv_shape = pred.shape
output_size = conv_shape[1]
conv_raw_dxdy = pred[:, :, :, :, 0:2]
conv_raw_dwdh = pred[:, :, :, :, 2:4]
xy_grid = np.meshgrid(np.arange(output_size), np.arange(output_size))
xy_grid = np.expand_dims(np.stack(xy_grid, axis=-1), axis=2)
xy_grid = np.tile(np.expand_dims(xy_grid, axis=0), [1, 1, 1, 3, 1])
xy_grid = xy_grid.astype(np.float)
pred_xy = ((special.expit(conv_raw_dxdy) * XYSCALE[i]) - 0.5 *
(XYSCALE[i] - 1) + xy_grid) * STRIDES[i]
pred_wh = (np.exp(conv_raw_dwdh) * ANCHORS[i])
pred[:, :, :, :, 0:4] = np.concatenate([pred_xy, pred_wh], axis=-1)
pred_bbox = [np.reshape(x, (-1, np.shape(x)[-1])) for x in pred_bbox]
pred_bbox = np.concatenate(pred_bbox, axis=0)
return pred_bbox
def postprocess_boxes(pred_bbox, org_img_shape, input_size, score_threshold):
'''remove boundary boxs with a low detection probability'''
valid_scale = [0, np.inf]
pred_bbox = np.array(pred_bbox)
pred_xywh = pred_bbox[:, 0:4]
pred_conf = pred_bbox[:, 4]
pred_prob = pred_bbox[:, 5:]
# (1) (x, y, w, h) --> (xmin, ymin, xmax, ymax)
pred_coor = np.concatenate([
pred_xywh[:, :2] - pred_xywh[:, 2:] * 0.5,
pred_xywh[:, :2] + pred_xywh[:, 2:] * 0.5
],
axis=-1)
# (2) (xmin, ymin, xmax, ymax) -> (xmin_org, ymin_org, xmax_org, ymax_org)
org_h, org_w = org_img_shape
resize_ratio = min(input_size / org_w, input_size / org_h)
dw = (input_size - resize_ratio * org_w) / 2
dh = (input_size - resize_ratio * org_h) / 2
pred_coor[:, 0::2] = 1.0 * (pred_coor[:, 0::2] - dw) / resize_ratio
pred_coor[:, 1::2] = 1.0 * (pred_coor[:, 1::2] - dh) / resize_ratio
# (3) clip some boxes that are out of range
pred_coor = np.concatenate([
np.maximum(pred_coor[:, :2], [0, 0]),
np.minimum(pred_coor[:, 2:], [org_w - 1, org_h - 1])
],
axis=-1)
invalid_mask = np.logical_or((pred_coor[:, 0] > pred_coor[:, 2]),
(pred_coor[:, 1] > pred_coor[:, 3]))
pred_coor[invalid_mask] = 0
# (4) discard some invalid boxes
bboxes_scale = np.sqrt(
np.multiply.reduce(pred_coor[:, 2:4] - pred_coor[:, 0:2], axis=-1))
scale_mask = np.logical_and((valid_scale[0] < bboxes_scale),
(bboxes_scale < valid_scale[1]))
# (5) discard some boxes with low scores
classes = np.argmax(pred_prob, axis=-1)
scores = pred_conf * pred_prob[np.arange(len(pred_coor)), classes]
score_mask = scores > score_threshold
mask = np.logical_and(scale_mask, score_mask)
coors, scores, classes = pred_coor[mask], scores[mask], classes[mask]
return np.concatenate(
[coors, scores[:, np.newaxis], classes[:, np.newaxis]], axis=-1)
def bboxes_iou(boxes1, boxes2):
'''calculate the Intersection Over Union value'''
boxes1 = np.array(boxes1)
boxes2 = np.array(boxes2)
boxes1_area = (boxes1[..., 2] - boxes1[..., 0]) * (boxes1[..., 3] -
boxes1[..., 1])
boxes2_area = (boxes2[..., 2] - boxes2[..., 0]) * (boxes2[..., 3] -
boxes2[..., 1])
left_up = np.maximum(boxes1[..., :2], boxes2[..., :2])
right_down = np.minimum(boxes1[..., 2:], boxes2[..., 2:])
inter_section = np.maximum(right_down - left_up, 0.0)
inter_area = inter_section[..., 0] * inter_section[..., 1]
union_area = boxes1_area + boxes2_area - inter_area
ious = np.maximum(1.0 * inter_area / union_area, np.finfo(np.float32).eps)
return ious
def nms(bboxes, iou_threshold, sigma=0.3, method='nms'):
"""
:param bboxes: (xmin, ymin, xmax, ymax, score, class)
Note: soft-nms, https://arxiv.org/pdf/1704.04503.pdf
https://github.com/bharatsingh430/soft-nms
"""
classes_in_img = list(set(bboxes[:, 5]))
best_bboxes = []
for cls in classes_in_img:
cls_mask = (bboxes[:, 5] == cls)
cls_bboxes = bboxes[cls_mask]
while len(cls_bboxes) > 0:
max_ind = np.argmax(cls_bboxes[:, 4])
best_bbox = cls_bboxes[max_ind]
best_bboxes.append(best_bbox)
cls_bboxes = np.concatenate(
[cls_bboxes[:max_ind], cls_bboxes[max_ind + 1:]])
iou = bboxes_iou(best_bbox[np.newaxis, :4], cls_bboxes[:, :4])
weight = np.ones((len(iou), ), dtype=np.float32)
assert method in ['nms', 'soft-nms']
if method == 'nms':
iou_mask = iou > iou_threshold
weight[iou_mask] = 0.0
if method == 'soft-nms':
weight = np.exp(-(1.0 * iou**2 / sigma))
cls_bboxes[:, 4] = cls_bboxes[:, 4] * weight
score_mask = cls_bboxes[:, 4] > 0.
cls_bboxes = cls_bboxes[score_mask]
return best_bboxes
def read_class_names(class_file_name):
'''loads class name from a file'''
names = {}
with open(class_file_name, 'r') as data:
for ID, name in enumerate(data):
names[ID] = name.strip('\n')
return names
def draw_bbox(image,
bboxes,
classes=read_class_names("./utilities/coco.names"),
show_label=True):
"""
bboxes: [x_min, y_min, x_max, y_max, probability, cls_id] format coordinates.
"""
num_classes = len(classes)
image_h, image_w, _ = image.shape
hsv_tuples = [(1.0 * x / num_classes, 1., 1.) for x in range(num_classes)]
colors = list(map(lambda x: colorsys.hsv_to_rgb(*x), hsv_tuples))
colors = list(
map(lambda x: (int(x[0] * 255), int(x[1] * 255), int(x[2] * 255)),
colors))
random.seed(0)
random.shuffle(colors)
random.seed(None)
for i, bbox in enumerate(bboxes):
coor = np.array(bbox[:4], dtype=np.int32)
fontScale = 0.5
score = bbox[4]
class_ind = int(bbox[5])
bbox_color = colors[class_ind]
bbox_thick = int(0.6 * (image_h + image_w) / 600)
c1, c2 = (coor[0], coor[1]), (coor[2], coor[3])
cv2.rectangle(image, c1, c2, bbox_color, bbox_thick)
if show_label:
bbox_mess = '%s: %.2f' % (classes[class_ind], score)
t_size = cv2.getTextSize(bbox_mess,
0,
fontScale,
thickness=bbox_thick // 2)[0]
cv2.rectangle(image, c1,
(c1[0] + t_size[0], c1[1] - t_size[1] - 3),
bbox_color, -1)
cv2.putText(image,
bbox_mess, (c1[0], c1[1] - 2),
cv2.FONT_HERSHEY_SIMPLEX,
fontScale, (0, 0, 0),
bbox_thick // 2,
lineType=cv2.LINE_AA)
return image
{
"cells": [
{
"cell_type": "markdown",
"metadata": {},
"source": [
"# Object Detection with YoloV4\n",
"This notebook is intended to be an example of how to use MIGraphX to perform object detection. The model used below is a pre-trained yolov4 from the ONNX model zoo. "
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"### Download dependencies"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
"import os.path\n",
"\n",
"if not os.path.exists(\"./utilities/coco.names\"):\n",
" !wget https://github.com/onnx/models/raw/master/vision/object_detection_segmentation/yolov4/dependencies/coco.names -P ./utilities/\n",
"if not os.path.exists(\"./utilities/yolov4_anchors.txt\"):\n",
" !wget https://github.com/onnx/models/raw/master/vision/object_detection_segmentation/yolov4/dependencies/yolov4_anchors.txt -P ./utilities/\n",
"if not os.path.exists(\"./utilities/input.jpg\"):\n",
" # The image used is from the COCO dataset (https://cocodataset.org/#explore)\n",
" # Other images can be tested by replacing the link below\n",
" image_link = \"https://farm3.staticflickr.com/2009/2306189268_88cc86b30f_z.jpg\"\n",
" !wget -O ./utilities/input.jpg $image_link\n",
"if not os.path.exists(\"./utilities/yolov4.onnx\"):\n",
" !wget https://github.com/onnx/models/raw/master/vision/object_detection_segmentation/yolov4/model/yolov4.onnx -P ./utilities/"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"### Serialize model using MIGraphX Driver\n",
"Please refer to the [MIGraphX Driver example](../../migraphx/migraphx_driver) if you would like more information about this tool."
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
"if not os.path.exists(\"yolov4_fp16.msgpack\"):\n",
" !/opt/rocm/bin/migraphx-driver compile ./utilities/yolov4.onnx --gpu --enable-offload-copy --fp16ref --binary -o yolov4_fp16.msgpack\n",
"if not os.path.exists(\"yolov4.msgpack\"):\n",
" !/opt/rocm/bin/migraphx-driver compile ./utilities/yolov4.onnx --gpu --enable-offload-copy --binary -o yolov4.msgpack"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"### Import libraries \n",
"Please refer to [this section](https://github.com/ROCmSoftwarePlatform/AMDMIGraphX#using-migraphx-python-module) of the main README if the migraphx module is not found. "
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
"import migraphx\n",
"import cv2\n",
"import time\n",
"import numpy as np\n",
"import image_processing as ip\n",
"from PIL import Image"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"### Read and pre-process image data"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
"input_size = 416\n",
"\n",
"original_image = cv2.imread(\"./utilities/input.jpg\")\n",
"original_image = cv2.cvtColor(original_image, cv2.COLOR_BGR2RGB)\n",
"original_image_size = original_image.shape[:2]\n",
"\n",
"image_data = ip.image_preprocess(np.copy(original_image), [input_size, input_size])\n",
"image_data = image_data[np.newaxis, ...].astype(np.float32)"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"### Load and run model"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
"# Load serialized model (either single- or half-precision)\n",
"model = migraphx.load(\"yolov4.msgpack\", format=\"msgpack\")\n",
"#model = migraphx.load(\"yolov4_fp16.msgpack\", format=\"msgpack\")\n",
"\n",
"# Get the name of the input parameter and convert image data to an MIGraphX argument\n",
"input_name = next(iter(model.get_parameter_shapes()))\n",
"input_argument = migraphx.argument(image_data)\n",
"\n",
"# Evaluate the model and convert the outputs for post-processing\n",
"outputs = model.run({input_name: input_argument})\n",
"detections = [np.ndarray(shape=out.get_shape().lens(), buffer=np.array(out.tolist()), dtype=float) for out in outputs]"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"### Post-process the model outputs and display image with detection bounding boxes"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
"ANCHORS = \"./utilities/yolov4_anchors.txt\"\n",
"STRIDES = [8, 16, 32]\n",
"XYSCALE = [1.2, 1.1, 1.05]\n",
"\n",
"ANCHORS = ip.get_anchors(ANCHORS)\n",
"STRIDES = np.array(STRIDES)\n",
"\n",
"pred_bbox = ip.postprocess_bbbox(detections, ANCHORS, STRIDES, XYSCALE)\n",
"bboxes = ip.postprocess_boxes(pred_bbox, original_image_size, input_size, 0.25)\n",
"bboxes = ip.nms(bboxes, 0.213, method='nms')\n",
"image = ip.draw_bbox(original_image, bboxes)\n",
"\n",
"image = Image.fromarray(image)\n",
"image.show()"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": []
}
],
"metadata": {
"kernelspec": {
"name": "python3",
"display_name": "Python 3.8.3 64-bit ('base': conda)"
},
"language_info": {
"codemirror_mode": {
"name": "ipython",
"version": 3
},
"file_extension": ".py",
"mimetype": "text/x-python",
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
"version": "3.8.3"
},
"metadata": {
"interpreter": {
"hash": "d7283edef085bb46d38a3069bce96b3de1793019cb5bd7b1e86bf9785b67f304"
}
},
"interpreter": {
"hash": "d7283edef085bb46d38a3069bce96b3de1793019cb5bd7b1e86bf9785b67f304"
}
},
"nbformat": 4,
"nbformat_minor": 2
}
\ No newline at end of file
......@@ -6,7 +6,7 @@ ARG PREFIX=/usr/local
RUN dpkg --add-architecture i386
# Add rocm repository
RUN sh -c 'echo deb [arch=amd64 trusted=yes] http://repo.radeon.com/rocm/apt/4.1/ xenial main > /etc/apt/sources.list.d/rocm.list'
RUN sh -c 'echo deb [arch=amd64 trusted=yes] http://repo.radeon.com/rocm/apt/4.2/ xenial main > /etc/apt/sources.list.d/rocm.list'
# Install dependencies
RUN apt-get update && DEBIAN_FRONTEND=noninteractive apt-get install -y --allow-unauthenticated \
......@@ -44,9 +44,6 @@ RUN ldconfig
ENV LC_ALL=C.UTF-8
ENV LANG=C.UTF-8
# Install rbuild
RUN pip3 install https://github.com/RadeonOpenCompute/rbuild/archive/master.tar.gz
# Install yapf
RUN pip3 install yapf==0.28.0
......@@ -57,6 +54,7 @@ RUN pip3 install -r /doc-requirements.txt
# Install dependencies
ADD dev-requirements.txt /dev-requirements.txt
ADD requirements.txt /requirements.txt
ADD rbuild.ini /rbuild.ini
COPY ./tools/install_prereqs.sh /
RUN /install_prereqs.sh /usr/local / && rm /install_prereqs.sh
......
[main]
cxx = ${rocm_path}/llvm/bin/clang++
cc = ${rocm_path}/llvm/bin/clang
deps =
pfultz2/rocm-recipes
-f requirements.txt
[gh]
ignore = danmar/cppcheck
deps =
-f dev-requirements.txt
oneapi-src/oneDNN@v1.7
define =
CMAKE_C_COMPILER_LAUNCHER=${deps_dir}/bin/ccache
CMAKE_CXX_COMPILER_LAUNCHER=${deps_dir}/bin/ccache
MIGRAPHX_ENABLE_CPU=On
[develop]
cxx = ${rocm_path}/llvm/bin/clang++
cc = ${rocm_path}/llvm/bin/clang
deps =
-f dev-requirements.txt
oneapi-src/oneDNN@v1.7
define =
CMAKE_C_COMPILER_LAUNCHER=${deps_dir}/bin/ccache
CMAKE_CXX_COMPILER_LAUNCHER=${deps_dir}/bin/ccache
MIGRAPHX_ENABLE_CPU=On
\ No newline at end of file
......@@ -7,56 +7,64 @@ include(CheckCXXLinkerFlag)
add_library(migraphx
adjust_allocation.cpp
analyze_streams.cpp
apply_alpha_beta.cpp
argument.cpp
auto_contiguous.cpp
eliminate_common_subexpression.cpp
decompose.cpp
propagate_constant.cpp
common.cpp
compile_src.cpp
convert_to_json.cpp
cpp_generator.cpp
dead_code_elimination.cpp
dom_info.cpp
dynamic_loader.cpp
eliminate_allocation.cpp
eliminate_contiguous.cpp
eliminate_common_subexpression.cpp
eliminate_concat.cpp
eliminate_contiguous.cpp
eliminate_data_type.cpp
eliminate_identity.cpp
eliminate_pad.cpp
file_buffer.cpp
rewrite_batchnorm.cpp
rewrite_rnn.cpp
rewrite_pooling.cpp
env.cpp
file_buffer.cpp
generate.cpp
inline_module.cpp
insert_pad.cpp
instruction.cpp
json.cpp
load_save.cpp
make_op.cpp
module.cpp
msgpack.cpp
normalize_attributes.cpp
normalize_ops.cpp
operation.cpp
opt/memory_coloring.cpp
opt/memory_coloring_impl.cpp
pass_manager.cpp
permutation.cpp
preallocate_param.cpp
process.cpp
program.cpp
module.cpp
propagate_constant.cpp
quantization.cpp
quantize_fp16.cpp
quantize_int8.cpp
reduce_dims.cpp
remap.cpp
shape.cpp
schedule.cpp
serialize.cpp
pass_manager.cpp
register_op.cpp
register_target.cpp
simplify_qdq.cpp
rewrite_batchnorm.cpp
rewrite_pooling.cpp
rewrite_quantization.cpp
rewrite_rnn.cpp
schedule.cpp
serialize.cpp
shape.cpp
simplify_algebra.cpp
simplify_reshapes.cpp
tmp_dir.cpp
value.cpp
verify_args.cpp
json.cpp
convert_to_json.cpp
opt/memory_coloring.cpp
opt/memory_coloring_impl.cpp
normalize_attributes.cpp
normalize_ops.cpp
)
configure_file(version.h.in include/migraphx/version.h)
rocm_set_soversion(migraphx ${MIGRAPHX_SO_VERSION})
......@@ -89,6 +97,7 @@ register_migraphx_ops(
cosh
cos
deconvolution
dequantizelinear
div
dot
elu
......@@ -98,6 +107,7 @@ register_migraphx_ops(
flatten
floor
gather
get_tuple_elem
greater
gru
identity
......@@ -111,13 +121,16 @@ register_migraphx_ops(
logical_or
logical_xor
logsoftmax
loop
lrn
lstm
max
min
mul
multibroadcast
multinomial
neg
nonzero
outline
pad
pooling
......@@ -126,6 +139,7 @@ register_migraphx_ops(
prelu
quant_convolution
quant_dot
quantizelinear
recip
reduce_max
reduce_mean
......@@ -134,6 +148,7 @@ register_migraphx_ops(
reduce_sum
relu
reshape
reverse
rnn
rnn_last_cell_output
rnn_last_hs_output
......@@ -141,6 +156,7 @@ register_migraphx_ops(
round
rsqrt
scalar
scatter
sigmoid
sign
sinh
......@@ -150,14 +166,17 @@ register_migraphx_ops(
sqdiff
sqrt
squeeze
step
sub
tanh
tan
topk
transpose
unary_not
undefined
unknown
unsqueeze
where
)
register_op(migraphx HEADER migraphx/op/rnn_variable_seq_lens.hpp OPERATORS op::rnn_var_sl_shift_output op::rnn_var_sl_shift_sequence)
register_op(migraphx HEADER migraphx/builtin.hpp OPERATORS builtin::literal builtin::param builtin::returns)
......
File mode changed from 100755 to 100644
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment