1 /*
2  * Copyright (C) 2019-2021 Intel Corporation
3  *
4  * SPDX-License-Identifier: MIT
5  *
6  */
7 
8 #pragma once
9 #include "shared/source/helpers/blit_commands_helper.h"
10 
11 namespace NEO {
12 
13 struct EnqueueProperties {
14     enum class Operation {
15         None,
16         Blit,
17         ExplicitCacheFlush,
18         EnqueueWithoutSubmission,
19         DependencyResolveOnGpu,
20         GpuKernel,
21         ProfilingOnly
22     };
23 
24     EnqueueProperties() = delete;
EnqueuePropertiesEnqueueProperties25     EnqueueProperties(bool blitEnqueue, bool hasKernels, bool isCacheFlushCmd, bool flushDependenciesOnly, bool isMarkerWithEvent,
26                       const BlitPropertiesContainer *blitPropertiesContainer) {
27         if (blitEnqueue) {
28             operation = Operation::Blit;
29             this->blitPropertiesContainer = blitPropertiesContainer;
30             return;
31         }
32 
33         if (hasKernels) {
34             operation = Operation::GpuKernel;
35             this->blitPropertiesContainer = blitPropertiesContainer;
36             return;
37         }
38 
39         if (isCacheFlushCmd) {
40             operation = Operation::ExplicitCacheFlush;
41             return;
42         }
43 
44         if (flushDependenciesOnly) {
45             operation = Operation::DependencyResolveOnGpu;
46             return;
47         }
48 
49         if (isMarkerWithEvent) {
50             operation = Operation::ProfilingOnly;
51             return;
52         }
53 
54         operation = Operation::EnqueueWithoutSubmission;
55     }
56 
isFlushWithoutKernelRequiredEnqueueProperties57     bool isFlushWithoutKernelRequired() const {
58         return (operation == Operation::Blit) || (operation == Operation::ExplicitCacheFlush) ||
59                (operation == Operation::DependencyResolveOnGpu) || (operation == EnqueueProperties::Operation::ProfilingOnly);
60     }
61 
62     const BlitPropertiesContainer *blitPropertiesContainer = nullptr;
63     Operation operation = Operation::EnqueueWithoutSubmission;
64 };
65 } // namespace NEO
66