ebe5054e04
The hipOccupancyMaxPotentialBlockSize API is meant to return the number of threads for the highest-occupancy workgroup, and the number of those workgroups. It was previously calculating the number of maximum-sized workgroups that would fit on a single CU. This is a mixture of the API we wanted (to calculate max potential block size) and the MaxBlocksPerMultiprocessor function. This patch fixes it up so that the internal occupancy calculation function works for two uses: the traditional function that calculates the maximum blocks per multiprocessor when a user passes in a fixed block size (used for hipMaxBlocksPerMultiprocessor style functions) and a function that calculates the size of a block that would lead to maximum occupancy, and how many blocks of that size would be needed to fill the whole GPU (for hipOccupancyMaxPotentialBlockSize style functions). This also updates the occupancy calculation function to prepare for gfx10, which does not have SGPR-based occupancy limits. Change-Id: Ie007b3f9d5ebc4e166b50a3a051498af35650f35
30 řádky
1.4 KiB
C++
30 řádky
1.4 KiB
C++
/* Copyright (c) 2015-present Advanced Micro Devices, Inc.
|
|
|
|
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. */
|
|
#pragma once
|
|
|
|
#include "device/device.hpp"
|
|
|
|
namespace hip_impl {
|
|
hipError_t ihipOccupancyMaxActiveBlocksPerMultiprocessor(
|
|
int* maxBlocksPerCU, int* numBlocksPerGrid, int* bestBlockSize,
|
|
const amd::Device& device, hipFunction_t func, int blockSize,
|
|
size_t dynamicSMemSize, bool bCalcPotentialBlkSz);
|
|
}
|