File: preemption_xe.inl

package info (click to toggle)
intel-compute-runtime 25.48.36300.8-1
  • links: PTS, VCS
  • area: main
  • in suites: sid
  • size: 80,652 kB
  • sloc: cpp: 939,022; lisp: 2,090; sh: 722; makefile: 162; python: 21
file content (52 lines) | stat: -rw-r--r-- 1,835 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
/*
 * Copyright (C) 2018-2025 Intel Corporation
 *
 * SPDX-License-Identifier: MIT
 *
 */

template <>
void PreemptionHelper::programCsrBaseAddress<GfxFamily>(LinearStream &preambleCmdStream, Device &device, const GraphicsAllocation *preemptionCsr) {
}

template <>
void PreemptionHelper::programStateSip<GfxFamily>(LinearStream &preambleCmdStream, Device &device, OsContext *context) {
    using STATE_SIP = typename GfxFamily::STATE_SIP;

    bool debuggingEnabled = device.getDebugger() != nullptr;

    if (debuggingEnabled) {
        GraphicsAllocation *sipAllocation = SipKernel::getSipKernel(device, context).getSipAllocation();

        auto sip = reinterpret_cast<STATE_SIP *>(preambleCmdStream.getSpace(sizeof(STATE_SIP)));
        STATE_SIP cmd = GfxFamily::cmdInitStateSip;
        cmd.setSystemInstructionPointer(sipAllocation->getGpuAddressToPatch());
        *sip = cmd;
    }
}

template <>
size_t PreemptionHelper::getRequiredPreambleSize<GfxFamily>(const Device &device) {
    return 0u;
}

template <>
size_t PreemptionHelper::getRequiredStateSipCmdSize<GfxFamily>(Device &device, bool isRcs) {
    size_t size = 0;
    bool debuggingEnabled = device.getDebugger() != nullptr;
    auto &hwInfo = device.getHardwareInfo();

    if (debuggingEnabled) {

        auto &productHelper = device.getProductHelper();
        auto *releaseHelper = device.getReleaseHelper();
        const auto &[isBasicWARequired, isExtendedWARequired] = productHelper.isPipeControlPriorToNonPipelinedStateCommandsWARequired(hwInfo, isRcs, releaseHelper);
        const auto isWARequired = isBasicWARequired || isExtendedWARequired;

        if (isWARequired) {
            size += MemorySynchronizationCommands<GfxFamily>::getSizeForSingleBarrier();
        }
        size += sizeof(typename GfxFamily::STATE_SIP);
    }
    return size;
}