Skip to content

Commit

Permalink
Resolve "incorrect-portions-license" errors: add no license lint to t…
Browse files Browse the repository at this point in the history
…op of GPU files with both licenses (facebookresearch#3965)

Summary:

This is the first diff in enabling linting. I wanted the diff which updates all files to be just the automated command and the .toml config files changes, so this diff is a preparation step.

We need this because we get errors due to having both NVidia and FB license comment headers in the same files. See the errors in D64429711 under "linter-coverage-verification" signal.

Context on linting: https://fb.workplace.com/groups/lintqa/posts/3762373340693743/?comment_id=3762915930639484&reply_comment_id=3763044163959994

Per OSS, we cannot remove the Nvidia notice: https://fb.workplace.com/groups/osssupport/posts/27179779734977284/?comment_id=27181801724775085&reply_comment_id=27181818148106776

Differential Revision: D64481766
  • Loading branch information
Michael Norris authored and facebook-github-bot committed Oct 17, 2024
1 parent 1a799d0 commit bfffd44
Show file tree
Hide file tree
Showing 27 changed files with 36 additions and 22 deletions.
1 change: 1 addition & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
# @lint-ignore-every LICENSELINT
# Copyright (c) Facebook, Inc. and its affiliates.
# All rights reserved.
#
Expand Down
3 changes: 2 additions & 1 deletion cmake/FindMKL.cmake
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
# Copyright (c) Facebook, Inc. and its affiliates.
# @lint-ignore-every LICENSELINT
# Copyright (c) Meta Platforms, Inc. and affiliates.
# All rights reserved.
#
# This source code is licensed under the BSD-style license found in the
Expand Down
3 changes: 2 additions & 1 deletion cmake/link_to_faiss_lib.cmake
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
# Copyright (c) Facebook, Inc. and its affiliates.
# @lint-ignore-every LICENSELINT
# Copyright (c) Meta Platforms, Inc. and affiliates.
# All rights reserved.
#
# This source code is licensed under the BSD-style license found in the
Expand Down
17 changes: 6 additions & 11 deletions faiss/gpu/GpuDistance.cu
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
// @lint-ignore-every LICENSELINT
/**
* Copyright (c) Facebook, Inc. and its affiliates.
*
Expand Down Expand Up @@ -51,20 +52,14 @@ using namespace raft::distance;
using namespace raft::neighbors;
#endif

/// Caches device major version
int device_major_version = -1;

bool should_use_raft(GpuDistanceParams args) {
if (device_major_version < 0) {
cudaDeviceProp prop;
int dev = args.device >= 0 ? args.device : getCurrentDevice();
cudaGetDeviceProperties(&prop, dev);
device_major_version = prop.major;
}
cudaDeviceProp prop;
int dev = args.device >= 0 ? args.device : getCurrentDevice();
cudaGetDeviceProperties(&prop, dev);

if (device_major_version < 7)
if (prop.major < 7)
return false;

int x; // test this useless variable lint still works?
return args.use_raft;
}

Expand Down
12 changes: 3 additions & 9 deletions faiss/gpu/GpuIndex.cu
Original file line number Diff line number Diff line change
Expand Up @@ -42,17 +42,11 @@ constexpr idx_t kAddVecSize = (idx_t)512 * 1024;
// FIXME: parameterize based on algorithm need
constexpr idx_t kSearchVecSize = (idx_t)32 * 1024;

/// Caches device major version
extern int device_major_version;

bool should_use_raft(GpuIndexConfig config_) {
if (device_major_version < 0) {
cudaDeviceProp prop;
cudaGetDeviceProperties(&prop, config_.device);
device_major_version = prop.major;
}
cudaDeviceProp prop;
cudaGetDeviceProperties(&prop, config_.device);

if (device_major_version < 7)
if (prop.major < 7)
return false;

return config_.use_raft;
Expand Down
1 change: 1 addition & 0 deletions faiss/gpu/GpuIndex.h
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
// @lint-ignore-every LICENSELINT
/**
* Copyright (c) Facebook, Inc. and its affiliates.
*
Expand Down
1 change: 1 addition & 0 deletions faiss/gpu/GpuIndexCagra.cu
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
// @lint-ignore-every LICENSELINT
/**
* Copyright (c) Facebook, Inc. and its affiliates.
*
Expand Down
1 change: 1 addition & 0 deletions faiss/gpu/GpuIndexCagra.h
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
// @lint-ignore-every LICENSELINT
/**
* Copyright (c) Facebook, Inc. and its affiliates.
*
Expand Down
1 change: 1 addition & 0 deletions faiss/gpu/GpuResources.cpp
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
// @lint-ignore-every LICENSELINT
/**
* Copyright (c) Facebook, Inc. and its affiliates.
*
Expand Down
1 change: 1 addition & 0 deletions faiss/gpu/GpuResources.h
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
// @lint-ignore-every LICENSELINT
/**
* Copyright (c) Facebook, Inc. and its affiliates.
*
Expand Down
1 change: 1 addition & 0 deletions faiss/gpu/StandardGpuResources.cpp
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
// @lint-ignore-every LICENSELINT
/**
* Copyright (c) Facebook, Inc. and its affiliates.
*
Expand Down
1 change: 1 addition & 0 deletions faiss/gpu/StandardGpuResources.h
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
// @lint-ignore-every LICENSELINT
/**
* Copyright (c) Facebook, Inc. and its affiliates.
*
Expand Down
1 change: 1 addition & 0 deletions faiss/gpu/impl/FlatIndex.cu
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
// @lint-ignore-every LICENSELINT
/**
* Copyright (c) Facebook, Inc. and its affiliates.
*
Expand Down
1 change: 1 addition & 0 deletions faiss/gpu/impl/FlatIndex.cuh
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
// @lint-ignore-every LICENSELINT
/**
* Copyright (c) Facebook, Inc. and its affiliates.
*
Expand Down
1 change: 1 addition & 0 deletions faiss/gpu/impl/RaftCagra.cu
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
// @lint-ignore-every LICENSELINT
/**
* Copyright (c) Facebook, Inc. and its affiliates.
*
Expand Down
1 change: 1 addition & 0 deletions faiss/gpu/impl/RaftCagra.cuh
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
// @lint-ignore-every LICENSELINT
/**
* Copyright (c) Facebook, Inc. and its affiliates.
*
Expand Down
1 change: 1 addition & 0 deletions faiss/gpu/impl/RaftFlatIndex.cu
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
// @lint-ignore-every LICENSELINT
/**
* Copyright (c) Facebook, Inc. and its affiliates.
*
Expand Down
1 change: 1 addition & 0 deletions faiss/gpu/impl/RaftFlatIndex.cuh
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
// @lint-ignore-every LICENSELINT
/**
* Copyright (c) Facebook, Inc. and its affiliates.
*
Expand Down
1 change: 1 addition & 0 deletions faiss/gpu/impl/RaftIVFFlat.cu
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
// @lint-ignore-every LICENSELINT
/**
* Copyright (c) Facebook, Inc. and its affiliates.
*
Expand Down
1 change: 1 addition & 0 deletions faiss/gpu/impl/RaftIVFFlat.cuh
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
// @lint-ignore-every LICENSELINT
/**
* Copyright (c) Facebook, Inc. and its affiliates.
*
Expand Down
1 change: 1 addition & 0 deletions faiss/gpu/impl/RaftIVFPQ.cu
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
// @lint-ignore-every LICENSELINT
/**
* Copyright (c) Facebook, Inc. and its affiliates.
*
Expand Down
1 change: 1 addition & 0 deletions faiss/gpu/impl/RaftIVFPQ.cuh
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
// @lint-ignore-every LICENSELINT
/**
* Copyright (c) Facebook, Inc. and its affiliates.
*
Expand Down
1 change: 1 addition & 0 deletions faiss/gpu/test/TestGpuDistance.cu
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
// @lint-ignore-every LICENSELINT
/**
* Copyright (c) Facebook, Inc. and its affiliates.
*
Expand Down
1 change: 1 addition & 0 deletions faiss/gpu/test/TestGpuIndexCagra.cu
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
// @lint-ignore-every LICENSELINT
/**
* Copyright (c) Facebook, Inc. and its affiliates.
*
Expand Down
1 change: 1 addition & 0 deletions faiss/gpu/test/TestGpuIndexIVFFlat.cpp
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
// @lint-ignore-every LICENSELINT
/**
* Copyright (c) Facebook, Inc. and its affiliates.
*
Expand Down
1 change: 1 addition & 0 deletions faiss/gpu/utils/RaftUtils.cu
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
// @lint-ignore-every LICENSELINT
/**
* Copyright (c) Facebook, Inc. and its affiliates.
*
Expand Down
1 change: 1 addition & 0 deletions faiss/gpu/utils/RaftUtils.h
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
// @lint-ignore-every LICENSELINT
/**
* Copyright (c) Facebook, Inc. and its affiliates.
*
Expand Down

0 comments on commit bfffd44

Please sign in to comment.