Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
99 changes: 0 additions & 99 deletions cmake/HalideUtils.cmake

This file was deleted.

File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
32 changes: 17 additions & 15 deletions cmake/InternalUtils.cmake → cmake/utils/InternalUtils.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,8 @@ function(add_coverage_to_target)
-O0 # TODO: reconcile this with CMake modes for something cleaner
-g
$<$<COMPILE_LANGUAGE:CXX>:--coverage>
)
)

if(CMAKE_VERSION VERSION_GREATER_EQUAL 3.13)
target_link_options(${add_coverage_to_target_TARGET}
PUBLIC
Expand All @@ -28,7 +29,8 @@ function(setup_install_targets)
"${multiValueArgs}" ${ARGN})

list(LENGTH setup_install_targets_INSTALL_TARGETS TARGETS_LENGTH)
if (${TARGETS_LENGTH} EQUAL 0)

if(${TARGETS_LENGTH} EQUAL 0)
message(FATAL_ERROR "Flashlight setup_install_targets called with "
"empty targets list.")
endif()
Expand All @@ -44,52 +46,51 @@ function(setup_install_targets)
ARCHIVE DESTINATION ${FL_INSTALL_LIB_DIR}
FRAMEWORK DESTINATION framework
INCLUDES DESTINATION ${FL_INSTALL_INC_DIR}
)
)

# Write and install targets file
install(
EXPORT flashlightTargets
NAMESPACE flashlight::
DESTINATION ${FL_INSTALL_CMAKE_DIR}
COMPONENT flashlight
)
)

# Write config file (used by projects including fl, such as examples)
include(CMakePackageConfigHelpers)
set(INCLUDE_DIRS include)
set(CMAKE_DIR ${FL_INSTALL_CMAKE_DIR})
configure_package_config_file(
${PROJECT_SOURCE_DIR}/cmake/flashlightConfig.cmake.in
${PROJECT_SOURCE_DIR}/cmake/utils/flashlightConfig.cmake.in
cmake/install/${FL_CONFIG_CMAKE_BUILD_DIR}/flashlightConfig.cmake
INSTALL_DESTINATION
${FL_INSTALL_CMAKE_DIR}
PATH_VARS INCLUDE_DIRS CMAKE_DIR
)
)
write_basic_package_version_file(
cmake/install/${FL_CONFIG_CMAKE_BUILD_DIR}/flashlightConfigVersion.cmake
COMPATIBILITY SameMajorVersion
)
)
install(FILES
${PROJECT_BINARY_DIR}/cmake/install/flashlightConfig.cmake
${PROJECT_BINARY_DIR}/cmake/install/flashlightConfigVersion.cmake
DESTINATION ${FL_INSTALL_CMAKE_DIR}
COMPONENT flashlight
)
)
set_target_properties(${setup_install_targets_INSTALL_TARGETS} PROPERTIES
VERSION "${flashlight_VERSION}"
SOVERSION "${flashlight_VERSION_MAJOR}")
endfunction(setup_install_targets)

function(setup_install_headers HEADER_DIR DEST_DIR)

# Move headers
install(
DIRECTORY ${HEADER_DIR}
COMPONENT headers
DESTINATION ${DEST_DIR}
FILES_MATCHING # preserve directory structure
PATTERN "*.h"
PATTERN "*.hpp"
PATTERN "*.h"
PATTERN "*.hpp"
PATTERN "*.cuh" # TODO: make this conditional, e.g. $<IF:FLASHLIGHT_USE_CUDA,"*.cuh","a^">
PATTERN "test*" EXCLUDE
PATTERN "tests" EXCLUDE
Expand All @@ -103,25 +104,25 @@ function(setup_install_headers HEADER_DIR DEST_DIR)
PATTERN "experimental" EXCLUDE
PATTERN "plugincompiler" EXCLUDE
PATTERN ".git" EXCLUDE
)
)
endfunction(setup_install_headers)

function(setup_install_find_module CONFIG_PATH)
# Only actually move module files if doing a standalone install; otherwise,
# assume we're being installed by a package manager
if (FL_BUILD_STANDALONE)
if(FL_BUILD_STANDALONE)
install(
FILES ${CONFIG_PATH}
DESTINATION ${FL_INSTALL_CMAKE_DIR}
)
)
endif()
endfunction()

function(set_executable_output_directory EXEC_TARGET DIRECTORY)
set_target_properties(${EXEC_TARGET} PROPERTIES
RUNTIME_OUTPUT_DIRECTORY
${DIRECTORY}
)
)
endfunction()

# Small utility function which wraps cmake_dependent options and throws an error if the user
Expand All @@ -143,5 +144,6 @@ function(fl_dependent_option)
message(FATAL_ERROR "${_dep} Required to build ${_option}")
endif()
endforeach()

cmake_dependent_option(${_option} ${_text} "${_val}" "${_deps}" ${_frce})
endfunction()
File renamed without changes.
File renamed without changes.
10 changes: 7 additions & 3 deletions cmake/utils/toolchain.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -8,12 +8,16 @@ message(STATUS "---- fm_cmake toolchain ----")
#append cmake dir to module path
set(FM_CMAKE_LIBRARY_DIR ${CMAKE_CURRENT_LIST_DIR})

list(APPEND CMAKE_MODULE_PATH "${FM_CMAKE_LIBRARY_DIR}")
message(STATUS "appended cmake/utils/ to cmake module path")
set(FM_CMAKE_UTILITY_DIR "${FM_CMAKE_LIBRARY_DIR}")
list(APPEND CMAKE_MODULE_PATH "${FM_CMAKE_UTILITY_DIR}")
message(VERBOSE "appended utility dir to cmake module path (${FM_CMAKE_UTILITY_DIR})")

list(APPEND CMAKE_MODULE_PATH "${FM_CMAKE_LIBRARY_DIR}/../")
message(STATUS "appended (${FM_CMAKE_LIBRARY_DIR}/../) cmake/ to cmake module path")
message(VERBOSE "appended (${FM_CMAKE_LIBRARY_DIR}/../) cmake/ to cmake module path")

set(FM_CMAKE_FIND_SCRIPT_DIR "${FM_CMAKE_LIBRARY_DIR}/../dependencies/")
list(APPEND CMAKE_MODULE_PATH "${FM_CMAKE_FIND_SCRIPT_DIR}")
message(VERBOSE "appended find scripts to module path (${FM_CMAKE_FIND_SCRIPT_DIR})")


include(fm_assertions)
Expand Down
12 changes: 4 additions & 8 deletions flashlight/fl/autograd/tensor/backend/cudnn/RNN.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -167,15 +167,12 @@ std::tuple<Tensor, Tensor, Tensor> CudnnAutogradExtension::rnn(

TensorDescriptor cyDesc(x.type(), hDims);

size_t workspaceSize =
getWorkspaceSize(handle, rnnDesc, seqLength, xDescs);
size_t reserveSize =
getReserveSize(handle, rnnDesc, seqLength, xDescs);
size_t workspaceSize = getWorkspaceSize(handle, rnnDesc, seqLength, xDescs);
size_t reserveSize = getReserveSize(handle, rnnDesc, seqLength, xDescs);

Tensor workspace({static_cast<long long>(workspaceSize)}, fl::dtype::b8);
// Space must be reused between forward and backward for cuDNN
payload->reserveSpace =
Tensor({static_cast<long long>(reserveSize)}, fl::dtype::b8);
payload->reserveSpace = Tensor({static_cast<long long>(reserveSize)}, fl::dtype::b8);

{
auto contiguousX = x.asContiguousTensor();
Expand Down Expand Up @@ -265,8 +262,7 @@ std::tuple<Tensor, Tensor, Tensor, Tensor> CudnnAutogradExtension::rnnBackward(
int outSize = hiddenSize * (bidirectional ? 2 : 1);

DropoutDescriptor dropout(dropProb);
RNNDescriptor rnnDesc(
input.type(), hiddenSize, numLayers, mode, bidirectional, dropout);
RNNDescriptor rnnDesc(input.type(), hiddenSize, numLayers, mode, bidirectional, dropout);
setCudnnRnnMathType(input, rnnDesc);

TensorDescriptorArray yDesc(seqLength, y.type(), {1, 1, outSize, batchSize});
Expand Down
37 changes: 36 additions & 1 deletion vcpkg.json
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,41 @@
"dependencies": [
"onednn"
]
},
"distributed": {
"description": "Dependencies for distributed backend",
"dependencies": [
"mpi"
]
},
"runtime": {
"description": "flashmini runtime helpers",
"dependencies": [
"glog",
"gflags"
]
},
"vision": {
"description": "vision pkg",
"dependencies": [
"opencv",
"stb"
]
},
"text": {
"description": "text pkg",
"dependencies": []
},
"speech": {
"description": "speech pkg",
"dependencies": [
"libsndfile",
"libogg",
"libvorbis",
"libflac",
"fftw3",
"openblas"
]
}
}
}
}
Loading