f618b3f075
Some infrastructures below, Implement SdmaTimePacket which records the global GPU timestamp. Introduce class AsyncMPSQ and AsyncMPMQ. AsyncMPSQ is aka async multiple packet single queue. It takes a set of packet when create and submits them to a GPU to run. While AsyncMPMQ is aka async multiple packet multiple queue. It manages a set of AsyncMPSQ, and use a forloop to do operations of AsyncMPSQ. Implement sdma_multicopy helper functions. Change-Id: I47e1d2ca9630113b2a1d85a0055f3f8ee629fb5f Signed-off-by: xinhui pan <xinhui.pan@amd.com>
71 строка
2.5 KiB
C++
71 строка
2.5 KiB
C++
/*
|
|
* Copyright (C) 2018 Advanced Micro Devices, Inc. All Rights Reserved.
|
|
*
|
|
* Permission is hereby granted, free of charge, to any person obtaining a
|
|
* copy of this software and associated documentation files (the "Software"),
|
|
* to deal in the Software without restriction, including without limitation
|
|
* the rights to use, copy, modify, merge, publish, distribute, sublicense,
|
|
* and/or sell copies of the Software, and to permit persons to whom the
|
|
* Software is furnished to do so, subject to the following conditions:
|
|
*
|
|
* The above copyright notice and this permission notice shall be included in
|
|
* all copies or substantial portions of the Software.
|
|
*
|
|
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
|
|
* THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR
|
|
* OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
|
|
* ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
|
|
* OTHER DEALINGS IN THE SOFTWARE.
|
|
*
|
|
*/
|
|
|
|
#ifndef __KFD__TEST__UTIL__QUEUE__H__
|
|
#define __KFD__TEST__UTIL__QUEUE__H__
|
|
|
|
#include "hsakmt.h"
|
|
#include <vector>
|
|
|
|
typedef struct {
|
|
HSAuint64 timestamp;
|
|
HSAuint64 timeConsumption;
|
|
HSAuint64 timeBegin;
|
|
HSAuint64 timeEnd;
|
|
} TimeStamp;
|
|
|
|
/* We have three pattern to put timestamp packet,
|
|
* NOTS: No timestamp packet insert.
|
|
* ALLTS: Put timestamp packet around every packet. This is the default behavoir.
|
|
* It will look like |timestamp|packet|timestamp|...|packet|timestamp|
|
|
* HEAD_TAIL: Put timestmap packet at head and tail to measure the overhead of a bunch of packet.
|
|
* It will look like |timestamp|packet|...|packet|timestamp|
|
|
*/
|
|
typedef enum {
|
|
NOTS = 0,
|
|
ALLTS = 1,
|
|
HEAD_TAIL = 2,
|
|
} TSPattern;
|
|
|
|
typedef struct {
|
|
/* input values*/
|
|
HSAuint32 node;
|
|
void *src;
|
|
void *dst;
|
|
HSAuint64 size;
|
|
/* input value for internal use.*/
|
|
HSAuint64 group;
|
|
/* output value*/
|
|
HSAuint64 timeConsumption;
|
|
HSAuint64 timeBegin;
|
|
HSAuint64 timeEnd;
|
|
/* private: Output values for internal use.*/
|
|
HSAuint64 queue_id;
|
|
HSAuint64 packet_id;
|
|
} SDMACopyParams;
|
|
|
|
void sdma_multicopy(SDMACopyParams *array, int n,
|
|
HSAuint64 *speedSmall = 0, HSAuint64 *speedLarge = 0, std::stringstream *s = 0);
|
|
void sdma_multicopy(std::vector<SDMACopyParams> &array, int mashup = 1, TSPattern tsp = ALLTS);
|
|
#endif //__KFD__TEST__UTIL__QUEUE__H__
|