File: migration_sync_data.h

package info (click to toggle)
intel-compute-runtime 25.44.36015.8-1
  • links: PTS, VCS
  • area: main
  • in suites: sid
  • size: 79,632 kB
  • sloc: cpp: 931,547; lisp: 2,074; sh: 719; makefile: 162; python: 21
file content (39 lines) | stat: -rw-r--r-- 1,275 bytes parent folder | download | duplicates (2)
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
/*
 * Copyright (C) 2021-2022 Intel Corporation
 *
 * SPDX-License-Identifier: MIT
 *
 */

#pragma once
#include "shared/source/command_stream/task_count_helper.h"
#include "shared/source/utilities/reference_tracked_object.h"

#include <cstdint>
#include <limits>

namespace NEO {
class MigrationSyncData : public ReferenceTrackedObject<MigrationSyncData> {
  public:
    static constexpr uint32_t locationUndefined = std::numeric_limits<uint32_t>::max();

    MigrationSyncData(size_t size);
    ~MigrationSyncData() override;
    uint32_t getCurrentLocation() const;
    void startMigration();
    void setCurrentLocation(uint32_t rootDeviceIndex);
    MOCKABLE_VIRTUAL void signalUsage(volatile TagAddressType *tagAddress, TaskCountType taskCount);
    bool isUsedByTheSameContext(volatile TagAddressType *tagAddress) const;
    MOCKABLE_VIRTUAL void waitOnCpu();
    bool isMigrationInProgress() const { return migrationInProgress; }
    void *getHostPtr() const { return hostPtr; }

  protected:
    MOCKABLE_VIRTUAL void yield() const;
    volatile TagAddressType *tagAddress = nullptr;
    void *hostPtr = nullptr;
    TaskCountType latestTaskCountUsed = 0u;
    uint32_t currentLocation = locationUndefined;
    bool migrationInProgress = false;
};
} // namespace NEO