tmoreau89 commented on a change in pull request #4500: [VTA][Python] Instruction Level Metal Test Infrastructure URL: https://github.com/apache/incubator-tvm/pull/4500#discussion_r356972520
########## File path: vta/tests/hardware/metal_test/insn_lib.py ########## @@ -0,0 +1,116 @@ +# Licensed to the Apache Software Foundation (ASF) under one +# or more contributor license agreements. See the NOTICE file +# distributed with this work for additional information +# regarding copyright ownership. The ASF licenses this file +# to you under the Apache License, Version 2.0 (the +# "License"); you may not use this file except in compliance +# with the License. You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, +# software distributed under the License is distributed on an +# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +# KIND, either express or implied. See the License for the +# specific language governing permissions and limitations +# under the License. + +from ctypes import * +from _macros_h import * +import numpy as np + +# RANDOM RANGE MAX +RAND_MAX = 32767 + +# test library +testlib = CDLL('./lib.so') + +def wrap_function(lib, funcname, restype, argtypes): + """Simplify wrapping ctypes functions""" + func = lib.__getattr__(funcname) + func.restype = restype + func.argtypes = argtypes + return func + +"""Structures""" +class VTAGenericInsn(Structure): + _fields_ = [("opcode", c_uint64, VTA_OPCODE_BIT_WIDTH), + ("pop_prev_dep", c_uint64, 1), + ("pop_next_dep", c_uint64, 1), + ("push_prev_dep", c_uint64, 1), + ("push_next_dep", c_uint64, 1), + ("pad_0", c_uint64, 64 - VTA_OPCODE_BIT_WIDTH - 4), + ("pad_1", c_uint64, 64)] + +class VTAUop(Structure): + _fields_ = [("dst_inx", c_uint32, VTA_LOG_ACC_BUFF_DEPTH), + ("src_idx", c_uint32, VTA_LOG_INP_BUFF_DEPTH), + ("wgt_idx", c_uint32, VTA_LOG_WGT_BUFF_DEPTH)] +# class VTAUop(Structure): Review comment: remove code ---------------------------------------------------------------- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. For queries about this service, please contact Infrastructure at: [email protected] With regards, Apache Git Services
