Skip to content

Commit

Permalink
-isystem をやめる && llvm/llvm-project-release-prs#698 の対応を手動で適用
Browse files Browse the repository at this point in the history
  • Loading branch information
enm10k committed Jan 17, 2024
1 parent 3883193 commit c22c737
Show file tree
Hide file tree
Showing 6 changed files with 45 additions and 5 deletions.
2 changes: 1 addition & 1 deletion CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -481,7 +481,7 @@ elseif (SORA_TARGET_OS STREQUAL "ubuntu")
third_party/NvCodec/NvCodec/NvDecoder/NvDecoder.cpp
third_party/NvCodec/NvCodec/NvEncoder/NvEncoderCuda.cpp
PROPERTIES
COMPILE_OPTIONS "-xcuda;--cuda-gpu-arch=sm_35;-std=gnu++17;-isystem${CMAKE_SOURCE_DIR}/_install/${SORA_TARGET}/release/llvm/clang/lib/clang/18/include/cuda_wrappers/bits;-isystem${CMAKE_SOURCE_DIR}/_install/${SORA_TARGET}/release/llvm/clang/lib/clang/18/include/cuda_wrappers"
COMPILE_OPTIONS "-xcuda;--cuda-gpu-arch=sm_35;-std=gnu++17"
)

# CUDA を要求したくないので libsora.a に含める
Expand Down
7 changes: 7 additions & 0 deletions include/sora/hwenc_nvcodec/nvcodec_decoder_cuda.h
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,15 @@
#define SORA_HWENC_NVCODEC_NVCODEC_DECODER_CUDA_H_

#include <memory>

// https://github.com/llvm/llvm-project-release-prs/pull/698/files
#pragma push_macro("__noinline__")
#undef __noinline__

#include <string>

#pragma pop_macro("__noinline__")

#include "sora/cuda_context.h"

namespace sora {
Expand Down
17 changes: 13 additions & 4 deletions third_party/NvCodec/NvCodec/NvDecoder/NvDecoder.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,15 @@
#include <algorithm>
#include <chrono>
#include <cmath>
// https://github.com/llvm/llvm-project-release-prs/pull/698/files

#pragma push_macro("__noinline__")
#undef __noinline__

#include <iostream>

#pragma pop_macro("__noinline__")

#include "NvDecoder/NvDecoder.h"
#include "sora/dyn/cuda.h"
#include "sora/dyn/nvcuvid.h"
Expand Down Expand Up @@ -623,8 +630,8 @@ int NvDecoder::HandlePictureDisplay(CUVIDPARSERDISPINFO* pDispInfo) {

CUVIDGETDECODESTATUS DecodeStatus;
memset(&DecodeStatus, 0, sizeof(DecodeStatus));
CUresult result =
dyn::cuvidGetDecodeStatus(m_hDecoder, pDispInfo->picture_index, &DecodeStatus);
CUresult result = dyn::cuvidGetDecodeStatus(
m_hDecoder, pDispInfo->picture_index, &DecodeStatus);
if (result == CUDA_SUCCESS &&
(DecodeStatus.decodeStatus == cuvidDecodeStatus_Error ||
DecodeStatus.decodeStatus == cuvidDecodeStatus_Error_Concealed)) {
Expand All @@ -645,7 +652,8 @@ int NvDecoder::HandlePictureDisplay(CUVIDPARSERDISPINFO* pDispInfo) {
(CUdeviceptr*)&pFrame, &m_nDeviceFramePitch, GetWidth() * m_nBPP,
m_nLumaHeight + (m_nChromaHeight * m_nNumChromaPlanes), 16));
} else {
CUDA_DRVAPI_CALL(dyn::cuMemAlloc((CUdeviceptr*)&pFrame, GetFrameSize()));
CUDA_DRVAPI_CALL(
dyn::cuMemAlloc((CUdeviceptr*)&pFrame, GetFrameSize()));
}
} else {
pFrame = new uint8_t[GetFrameSize()];
Expand Down Expand Up @@ -783,7 +791,8 @@ NvDecoder::NvDecoder(CUcontext cuContext,
videoParserParameters.pfnGetOperatingPoint = HandleOperatingPointProc;
videoParserParameters.pfnGetSEIMsg =
m_bExtractSEIMessage ? HandleSEIMessagesProc : NULL;
NVDEC_API_CALL(dyn::cuvidCreateVideoParser(&m_hParser, &videoParserParameters));
NVDEC_API_CALL(
dyn::cuvidCreateVideoParser(&m_hParser, &videoParserParameters));
}

NvDecoder::~NvDecoder() {
Expand Down
8 changes: 8 additions & 0 deletions third_party/NvCodec/NvCodec/NvDecoder/NvDecoder.h
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,15 @@
#include <assert.h>
#include <stdint.h>
#include <string.h>

// https://github.com/llvm/llvm-project-release-prs/pull/698/files
#pragma push_macro("__noinline__")
#undef __noinline__

#include <iostream>

#pragma pop_macro("__noinline__")

#include <map>
#include <mutex>
#include <sstream>
Expand Down
8 changes: 8 additions & 0 deletions third_party/NvCodec/NvCodec/NvEncoder/NvEncoder.h
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,15 @@

#include <stdint.h>
#include <string.h>

// https://github.com/llvm/llvm-project-release-prs/pull/698/files
#pragma push_macro("__noinline__")
#undef __noinline__

#include <iostream>

#pragma pop_macro("__noinline__")

#include <mutex>
#include <sstream>
#include <string>
Expand Down
8 changes: 8 additions & 0 deletions third_party/NvCodec/NvCodec/NvEncoder/NvEncoderCuda.h
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,15 @@

#include <cuda.h>
#include <stdint.h>

// https://github.com/llvm/llvm-project-release-prs/pull/698/files
#pragma push_macro("__noinline__")
#undef __noinline__

#include <mutex>

#pragma pop_macro("__noinline__")

#include <vector>
#include "NvEncoder.h"

Expand Down

0 comments on commit c22c737

Please sign in to comment.