Skip to content

Commit

Permalink
Merge branch 'amd-develop' into amd-master
Browse files Browse the repository at this point in the history
Change-Id: I0e3bbaf5e872fe5c064f0d792c074d13be50e289
  • Loading branch information
mangupta committed Oct 16, 2016
2 parents f5faeab + 86c718a commit 7e8bfba
Show file tree
Hide file tree
Showing 73 changed files with 1,794 additions and 1,363 deletions.
19 changes: 10 additions & 9 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -143,7 +143,7 @@ add_to_config(_buildInfo COMPILE_HIP_ATP_MARKER)
#############################
# Build steps
#############################
# Rebuild cmake cache updates .buildInfo and .version
# Rebuild cmake cache updates .hipInfo and .hipVersion
add_custom_target(update_build_and_version_info ALL COMMAND make rebuild_cache)

# Build clang hipify if enabled
Expand Down Expand Up @@ -198,12 +198,12 @@ if(HIP_PLATFORM STREQUAL "hcc")
set_source_files_properties(${SOURCE_FILES} PROPERTIES OBJECT_DEPENDS ${PROJECT_BINARY_DIR}/hcc_version.txt)
add_dependencies(hip_hcc check_hcc_version update_build_and_version_info)

# Generate .buildInfo
file(WRITE "${PROJECT_BINARY_DIR}/.buildInfo" ${_buildInfo})
# Generate .hipInfo
file(WRITE "${PROJECT_BINARY_DIR}/.hipInfo" ${_buildInfo})
endif()

# Generate .version
file(WRITE "${PROJECT_BINARY_DIR}/.version" ${_versionInfo})
# Generate .hipVersion
file(WRITE "${PROJECT_BINARY_DIR}/.hipVersion" ${_versionInfo})

# Build doxygen documentation
add_custom_target(doc COMMAND HIP_PATH=${CMAKE_CURRENT_SOURCE_DIR} doxygen ${CMAKE_CURRENT_SOURCE_DIR}/docs/doxygen-input/doxy.cfg
Expand All @@ -219,13 +219,14 @@ if(HIP_PLATFORM STREQUAL "hcc")
else()
install(TARGETS hip_hcc DESTINATION lib)
endif()
install(FILES ${CMAKE_CURRENT_SOURCE_DIR}/src/hip_ir.ll DESTINATION lib)

# Install .buildInfo
install(FILES ${PROJECT_BINARY_DIR}/.buildInfo DESTINATION lib)
# Install .hipInfo
install(FILES ${PROJECT_BINARY_DIR}/.hipInfo DESTINATION lib)
endif()

# Install .version
install(FILES ${PROJECT_BINARY_DIR}/.version DESTINATION bin)
# Install .hipVersion
install(FILES ${PROJECT_BINARY_DIR}/.hipVersion DESTINATION bin)

# Install src, bin, include & cmake if necessary
execute_process(COMMAND test ${CMAKE_INSTALL_PREFIX} -ef ${CMAKE_CURRENT_SOURCE_DIR}
Expand Down
67 changes: 18 additions & 49 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,9 +18,9 @@ After making HIP, don't forget the "make install" step !

## Adding a new HIP API

- Add a translation to the bin/hipify tool ; many examples abound.
- Add a translation to the hipify-clang tool ; many examples abound.
- For stat tracking purposes, place the API into an appropriate stat category ("dev", "mem", "stream", etc).
- Add a inlined NVCC implementation for the function in include/nvcc_detail/hip_runtime_api.h.
- Add a inlined NVCC implementation for the function in include/hip/nvcc_detail/hip_runtime_api.h.
- These are typically headers
- Add an HCC definition and Doxygen comments for the function in include/hcc_detail/hip_runtime_api.h
- Source implementation typically go in src/hcc_detail/hip_hcc.cpp. The implementation may involve
Expand Down Expand Up @@ -59,7 +59,7 @@ Selected multilib: .;@m64

The unix `date` command can print the HCC-format work-week for a specific date , ie:
```
> date --utc +%y%W%w -d 2015-11-09
> date --utc +%y%U%w -d 2015-11-09
15451
```

Expand Down Expand Up @@ -125,60 +125,29 @@ Differences or limitations of HIP APIs as compared to CUDA APIs should be clearl
is used by the GetLastError and PeekLastError functions - if a HIP API simply returns, then the error will not be logged correctly.



#### Presubmit Testing:
Before checking in or submitting a pull request, run all Rodinia tests and ensure pass results match starting point:
Before checking in or submitting a pull request, run all directed tests (see tests/README.md) and all Rodinia tests.
Ensure pass results match starting point:

```shell
> cd examples/
> ./run_all.sh
```

Recent results :

```
hip2/examples/rodinia_3.0/hip$ make test
--TESTING: b+tree
executing: ../../test/b+tree/run0.cmd... PASSED!
--TESTING: backprop
executing: ../../test/backprop/run0.cmd... PASSED!
--TESTING: bfs
executing: ../../test/bfs/run0.cmd... PASSED!
executing: ../../test/bfs/run1.cmd... PASSED!
--TESTING: cfd
executing: ../../test/cfd/run0.cmd... PASSED!
executing: ../../test/cfd/run1.cmd... PASSED!
--TESTING: gaussian
executing: ../../test/gaussian/run0.cmd... PASSED!
--TESTING: heartwall
executing: ../../test/heartwall/run0.cmd... PASSED!
--TESTING: hotspot
executing: ../../test/hotspot/run0.cmd... PASSED!
--TESTING: kmeans
executing: ../../test/kmeans/run0.cmd... PASSED!
executing: ../../test/kmeans/run1.cmd... PASSED!
executing: ../../test/kmeans/run2.cmd... PASSED!
executing: ../../test/kmeans/run3.cmd... PASSED!
--TESTING: lavaMD
executing: ../../test/lavaMD/run0.cmd... PASSED!
executing: ../../test/lavaMD/run1.cmd... PASSED!
executing: ../../test/lavaMD/run2.cmd... PASSED!
executing: ../../test/lavaMD/run3.cmd... PASSED!
executing: ../../test/lavaMD/run4.cmd... PASSED!
--TESTING: lud
executing: ../../test/lud/run0.cmd... PASSED!
--TESTING: myocyte
executing: ../../test/myocyte/run0.cmd... PASSED!
--TESTING: nn
executing: ../../test/nn/run0.cmd... PASSED!
--TESTING: nw
executing: ../../test/nw/run0.cmd... PASSED!
--TESTING: pathfinder
executing: ../../test/pathfinder/run0.cmd... PASSED!
--TESTING: srad
executing: ../../test/srad/run0.cmd... PASSED!
--TESTING: streamcluster
executing: ../../test/streamcluster/run0.cmd... PASSED!
```
#### Checkin messages
Follow existing best practice for writing a good Git commit message. Some tips:
http://chris.beams.io/posts/git-commit/
https://robots.thoughtbot.com/5-useful-tips-for-a-better-commit-message

In particular :
- Use imperative voice, ie "Fix this bug", "Refactor the XYZ routine", "Update the doc".
Not : "Fixing the bug", "Fixed the bug", "Bug fix", etc.
- Subject should summarize the commit. Do not end subject with a period. Use a blank line
after the subject.



## Doxygen Editing Guidelines

Expand Down
12 changes: 10 additions & 2 deletions bin/hipcc
Original file line number Diff line number Diff line change
Expand Up @@ -52,9 +52,9 @@ $verbose = $ENV{'HIPCC_VERBOSE'} // 0;
$HIP_PATH=$ENV{'HIP_PATH'} // dirname (dirname $0); # use parent directory of hipcc

#---
# Read .buildInfo
# Read .hipInfo
my %hipConfig = ();
parse_config_file("$HIP_PATH/lib/.buildInfo", \%hipConfig);
parse_config_file("$HIP_PATH/lib/.hipInfo", \%hipConfig);

#---
#HIP_PLATFORM controls whether to use NVCC or HCC for compilation:
Expand Down Expand Up @@ -119,6 +119,9 @@ if ($HIP_PLATFORM eq "hcc") {
if ($ROCM_TARGET eq "hawaii") {
$HIPLDFLAGS .= " -amdgpu-target=AMD:AMDGPU:7:0:1";
}
if ($ROCM_TARGET eq "polaris") {
$HIPLDFLAGS .= " -amdgpu-target=AMD:AMDGPU:8:0:3";
}

# Add trace marker library:
# TODO - once we cleanly separate the HIP API headers from HIP library headers this logic should move to CMakebuild option - apps do not need to see the marker library.
Expand Down Expand Up @@ -196,6 +199,11 @@ if($HIP_PLATFORM eq "hcc"){
}
}

if(($HIP_PLATFORM eq "hcc") and defined $ENV{HIP_EXPERIMENTAL}){
$EXPORT_LL=" ";
$ENV{HCC_EXTRA_LIBRARIES}="$HIP_PATH/lib/hip_ir.ll\n";
}

if($HIP_PLATFORM eq "nvcc"){
$ISACMD .= "$HIP_PATH/bin/hipcc -ptx ";
if($ARGV[0] eq "--genco"){
Expand Down
9 changes: 5 additions & 4 deletions bin/hipconfig
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
#!/usr/bin/perl -w

$HIP_BASE_VERSION_MAJOR = "0";
$HIP_BASE_VERSION_MINOR = "92";
$HIP_BASE_VERSION_MAJOR = "1";
$HIP_BASE_VERSION_MINOR = "0";

# Need perl > 5.10 to use logic-defined or
use 5.006; use v5.10.1;
Expand Down Expand Up @@ -86,9 +86,9 @@ if ($HIP_PLATFORM eq "nvcc") {
};

#---
# Read .version
# Read .hipVersion
my %hipVersion = ();
parse_config_file("$HIP_PATH/bin/.version", \%hipVersion);
parse_config_file("$HIP_PATH/bin/.hipVersion", \%hipVersion);
$HIP_VERSION_MAJOR = $hipVersion{'HIP_VERSION_MAJOR'} // $HIP_BASE_VERSION_MAJOR;
$HIP_VERSION_MINOR = $hipVersion{'HIP_VERSION_MINOR'} // $HIP_BASE_VERSION_MINOR;
$HIP_VERSION_PATCH = $hipVersion{'HIP_VERSION_PATCH'} // "0";
Expand Down Expand Up @@ -129,6 +129,7 @@ if (!$printed or $p_full) {
print ("HSA_PATH : $HSA_PATH\n");
print ("HCC_HOME : $HCC_HOME\n");
system("$HCC_HOME/bin/hcc --version");
system("$HCC_HOME/compiler/bin/llc --version");
print ("HCC-cxxflags : ");
system("$HCC_HOME/bin/hcc-config --cxxflags");
print ("HCC-ldflags : ");
Expand Down
Empty file modified docs/doxygen-input/doxy.cfg
100755 → 100644
Empty file.
6 changes: 3 additions & 3 deletions docs/markdown/CUDA_Runtime_API_functions_supported_by_HIP.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,17 +2,17 @@

| **CUDA** | **HIP** | **CUDA description** |
|-----------------------------------------------------------|-------------------------------|--------------------------------------------------------------------------------------------------------------------------------|
| `cudaChooseDevice` | | Select compute-device which best matches criteria. |
| `cudaChooseDevice` | `hipChooseDevice` | Select compute-device which best matches criteria. |
| `cudaDeviceGetAttribute` | `hipDeviceGetAttribute` | Returns information about the device. |
| `cudaDeviceGetByPCIBusId` | | Returns a handle to a compute device. |
| `cudaDeviceGetCacheConfig` | `hipDeviceGetCacheConfig` | Returns the preferred cache configuration for the current device. |
| `cudaDeviceGetLimit` | | Returns resource limits. |
| `cudaDeviceGetLimit` | `hipDeviceGetLimit` | Returns resource limits. |
| `cudaDeviceGetPCIBusId` | | Returns a PCI Bus Id string for the device. |
| `cudaDeviceGetSharedMemConfig` | `hipDeviceGetSharedMemConfig` | Returns the shared memory configuration for the current device. |
| `cudaDeviceGetStreamPriorityRange` | | Returns numerical values that correspond to the least and greatest stream priorities. |
| `cudaDeviceReset` | `hipDeviceReset` | Destroy all allocations and reset all state on the current device in the current process. |
| `cudaDeviceSetCacheConfig` | `hipDeviceSetCacheConfig` | Sets the preferred cache configuration for the current device. |
| `cudaDeviceSetLimit` | | Set resource limits. |
| `cudaDeviceSetLimit` | `hipDeviceSetLimit` | Set resource limits. |
| `cudaDeviceSetSharedMemConfig` | `hipDeviceSetSharedMemConfig` | Sets the shared memory configuration for the current device. |
| `cudaDeviceSynchronize` | `hipDeviceSynchronize` | Wait for compute device to finish. |
| `cudaGetDevice` | `hipGetDevice` | Returns which device is currently being used. |
Expand Down
Empty file modified docs/markdown/hip_kernel_language.md
100755 → 100644
Empty file.
11 changes: 11 additions & 0 deletions hipify-clang/src/Cuda2Hip.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -635,6 +635,17 @@ struct cuda2hipMap {
cuda2hipRename["cudaSharedMemBankSizeFourByte"] = {"hipSharedMemBankSizeFourByte", CONV_DEV, API_RUNTIME};
cuda2hipRename["cudaSharedMemBankSizeEightByte"] = {"hipSharedMemBankSizeEightByte", CONV_DEV, API_RUNTIME};

// Limits
cuda2hipRename["cudaLimit"] = {"hipLimit_t", CONV_DEV, API_RUNTIME};
// unsupported yet
//cuda2hipRename["cudaLimitStackSize"] = {"hipLimitStackSize", CONV_DEV, API_RUNTIME};
//cuda2hipRename["cudaLimitPrintfFifoSize"] = {"hipLimitPrintfFifoSize", CONV_DEV, API_RUNTIME};
// unsupported yet
cuda2hipRename["cudaLimitMallocHeapSize"] = {"hipLimitMallocHeapSize", CONV_DEV, API_RUNTIME};
//cuda2hipRename["cudaLimitDevRuntimeSyncDepth"] = {"hipLimitPrintfFifoSize", CONV_DEV, API_RUNTIME};
//cuda2hipRename["cudaLimitDevRuntimePendingLaunchCount"] = {"hipLimitMallocHeapSize", CONV_DEV, API_RUNTIME};
cuda2hipRename["cudaDeviceGetLimit"] = {"hipDeviceGetLimit", CONV_DEV, API_RUNTIME};

// Profiler
// unsupported yet
//cuda2hipRename["cudaProfilerInitialize"] = {"hipProfilerInitialize", CONV_OTHER, API_RUNTIME};
Expand Down
22 changes: 22 additions & 0 deletions include/hip/hcc.h
Original file line number Diff line number Diff line change
@@ -1,3 +1,25 @@
/*
Copyright (c) 2015-2016 Advanced Micro Devices, Inc. All rights reserved.
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE.
*/

#ifndef HCC_H
#define HCC_H

Expand Down
22 changes: 22 additions & 0 deletions include/hip/hcc_detail/hcc_acc.h
Original file line number Diff line number Diff line change
@@ -1,3 +1,25 @@
/*
Copyright (c) 2015-2016 Advanced Micro Devices, Inc. All rights reserved.
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE.
*/

#ifndef HCC_ACC_H
#define HCC_ACC_H
#include "hip/hip_runtime_api.h"
Expand Down
Loading

0 comments on commit 7e8bfba

Please sign in to comment.